While investigating JDK-8367627 (valhalla issue), I noticed that in some cases we miss out on optimizing MemBar nodes. In the attached reproducer, we have a volatile load that results in a MemBarAcquire with a LoadL node has its Precedent input. The LoadL node gets folded to a constant at the very first IGVN pass, and this prevents the MemBar node from being removed, as MemBarNode::Ideal relies on having a memory node as Precedent input to replace its projections by its inputs.
By artificially delaying the optimization on the LoadL node we can force the MemBar node to eventually get removed, which shows that it is most likely correct to do so.
This can be reproduced as follows:
java -Xcomp -XX:-TieredCompilation -Xbatch -XX:CompileCommand=compileonly,*Test::test Test.java
By artificially delaying the optimization on the LoadL node we can force the MemBar node to eventually get removed, which shows that it is most likely correct to do so.
This can be reproduced as follows:
java -Xcomp -XX:-TieredCompilation -Xbatch -XX:CompileCommand=compileonly,*Test::test Test.java
- relates to
-
JDK-8367627 [lworld] C2: Missed Ideal() optimization opportunity in PhaseIterGVN
-
- In Progress
-