RFR: 8292285: C2: remove unreachable block after NeverBranch-to-Goto conversion
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Mon Aug 15 08:07:51 UTC 2022
`NeverBranch` nodes introduce fake branches out of infinite loops to simplify intermediate optimizations that assume full reachability:
![before](https://user-images.githubusercontent.com/8792647/184355521-8b54725e-f7d2-4d37-a7ba-e0f7d1086421.png)
`PhaseCFG::convert_NeverBranch_to_Goto()` transforms such nodes into simple `Goto` nodes, removing the fake branch and thus making its destination block unreachable:
![after](https://user-images.githubusercontent.com/8792647/184355553-3b862832-7302-4de2-aa29-86d7da0d985a.png)
This changeset removes the unreachable destination block created by `PhaseCFG::convert_NeverBranch_to_Goto()` from the list of basic blocks:
![after-removal](https://user-images.githubusercontent.com/8792647/184355581-82038683-3f4f-4f4f-a8d7-16e507bfdf0c.png)
Removing unreachable blocks created by `PhaseCFG::convert_NeverBranch_to_Goto()` simplifies late control-flow analysis (for example, recomputing dominators during the output phase as required for late barrier analysis in Generational ZGC) and slightly reduces the size of the generated code.
#### Testing
- hs-tier1-3 (windows-x64, linux-x64, linux-aarch64, and macosx-x64; release and debug mode). The changeset does not introduce new test cases because it is already exercised by at least two existing ones (`compiler/inlining/StringConcatInfiniteLoop.java`, `compiler/loopopts/TestInfiniteLoopNotInnerMost.java`).
- fuzzing (~30 min. on each platform).
-------------
Commit messages:
- Simplify comment
- Remove unreachable blocks after 'convert_NeverBranch_to_Goto'
Changes: https://git.openjdk.org/jdk/pull/9853/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9853&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8292285
Stats: 13 lines in 1 file changed: 13 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/9853.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9853/head:pull/9853
PR: https://git.openjdk.org/jdk/pull/9853
More information about the hotspot-compiler-dev
mailing list