RFR: 8301489: C1: ShortLoopOptimizer might lift instructions before their inputs [v3]
Daniel Skantz
duke at openjdk.org
Tue Jun 20 10:21:51 UTC 2023
> ShortLoopOptimizer might lift instructions before their inputs on some graph shapes. We propose adding a check that the insertion point for an instruction that is a candidate for hoisting should not be higher up the dominator tree than any inputs to the instruction.
>
> Testing: tier1-tier3.
>
> Additional testing: observed that `(cur_invariant && !v.is_valid())` never occurs on tier1-tier3 before the added test case.
> Also verified that the depth check is equivalent to `(*vp->block() == _insert->block()) || dominates(*vp, _insert)` on all of tier1-tier3.
>
> Failure case: in the attached image the `arraylength` instruction from B10 is lifted to B0, as the dominator of B10 is calculated as B0. This is based on the logic in [`ComputeLinearScanOrder::compute_dominator_impl`](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/c1/c1_IR.cpp#L801). But the array input is in Block 3. This is later spotted in `c1_LIRAssembler.cpp` with `Error: ShouldNotReachHere()`. We can reproduce the error on other instructions too -- the reader may refer to the test case provided.
>
> 
Daniel Skantz has updated the pull request incrementally with one additional commit since the last revision:
Tweak test #iterations
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14492/files
- new: https://git.openjdk.org/jdk/pull/14492/files/ebb6655a..074d1ed7
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14492&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14492&range=01-02
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/14492.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14492/head:pull/14492
PR: https://git.openjdk.org/jdk/pull/14492
More information about the hotspot-compiler-dev
mailing list