RFR: 8273454: C2: Transform (-a)*(-b) into a*b [v2]
Tobias Hartmann
thartmann at openjdk.java.net
Thu Sep 9 07:34:04 UTC 2021
On Thu, 9 Sep 2021 02:45:09 GMT, Eric Liu <eliu at openjdk.org> wrote:
>> I wonder that too, so is the rest of MulINode/MulLNode::Ideal() code (and many other places). I am not sure how to workaround the different types, any suggestions?
>
> Just a dogfood, but it works. https://gist.github.com/theRealELiu/328d62157975b1f20e3626b3ef747eb4
>
> Too much abstraction makes the code hard to read. One needs to check the concrete class to identify what the code exactly is, E.g. In my patch, add_id() may be TypeInt::ZERO or TypeLong::Zero, even TypeD::ZERO. So I'm not sure if it's a good idea. Is there any guidelines to this issue, try to abstract them or make the readability in the first place? @TobiHartmann
Yes, I would also prefer to move the optimization into `MulNode::Ideal`. @theRealELiu's patch is good but can be further improved by modifying the node inputs instead of returning a new node (similar to the other optimizations in `MulNode::Ideal`).
-------------
PR: https://git.openjdk.java.net/jdk/pull/5403
More information about the hotspot-compiler-dev
mailing list