RFR: 8330163: C2: improve CMoveNode::Value() when condition is always true or false
Christian Hagedorn
chagedorn at openjdk.org
Fri Apr 12 13:35:42 UTC 2024
On Fri, 12 Apr 2024 11:45:05 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> This is another small change from something I ran into while working
> on 8275202. `CMoveNode::Value` can be improved when the condition is
> known to be always true or false. That doesn't affect IGVN (as the
> `CMove` is removed in that case) but it can be useful for passes that
> propagates types such as CCP. In the IR tests, the backbranch of the
> loop is never taken when the root of the compilation is `test1`. With
> the change, CCP can eliminate it. Without, it can't.
Looks good to me.
src/hotspot/share/opto/movenode.cpp line 176:
> 174: }
> 175: if (phase->type(in(Condition)) == TypeInt::ONE) {
> 176: return phase->type(in(IfTrue))->filter(_type); // Always pick right(true) input
Suggestion:
return phase->type(in(IfFalse))->filter(_type); // Always pick left (false) input
}
if (phase->type(in(Condition)) == TypeInt::ONE) {
return phase->type(in(IfTrue))->filter(_type); // Always pick right (true) input
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18757#pullrequestreview-1997063700
PR Review Comment: https://git.openjdk.org/jdk/pull/18757#discussion_r1562559591
More information about the hotspot-compiler-dev
mailing list