RFR: 8261308: C2: assert(inner->is_valid_counted_loop(T_INT) && inner->is_strip_mined()) failed: OuterStripMinedLoop should have been removed [v2]
Roland Westrelin
roland at openjdk.java.net
Mon Mar 1 08:45:11 UTC 2021
> The inner counted loop of the test case starts at 1 and stops at 1 so
> runs for one iteration. A counted loop is created for it. The iv Phi
> is found to be the constant 1 and its type is set by:
>
> l->phi()->as_Phi()->set_type(l->phi()->Value(&_igvn));
>
> in PhaseIdealLoop::is_counted_loop() but it's not replaced by the
> constant 1 yet so the counted loop's shape is preserved.
>
> IdealLoopTree::do_one_iteration_loop() runs but doesn't optimize the
> loop because the trip count is not set to 1. The loop contains a range
> check and range check elimination is applied. That causes the loop
> exit test to be adjusted with a MinI(..) expression. When IGVN runs
> next, the phi is replaced with 1 but because the exit test was
> changed, IGVN can't prove it always fails. So the loop is not removed
> which causes the assert failure as loop opts progress.
>
> The fix I propose is for IdealLoopTree::do_one_iteration_loop() to
> remove the 1 iteration loop. The reason it doesn't happen is that
> IdealLoopTree::compute_trip_count() doesn't set the trip count because
> it finds a zero trip count: limit - init = 1 - 1 = 0. All loops, once
> entered execute at least once. So I think, it's safe to set the trip
> count to 1 in those cases.
Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
comment
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2529/files
- new: https://git.openjdk.java.net/jdk/pull/2529/files/5f9ac283..42c864ec
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2529&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2529&range=00-01
Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jdk/pull/2529.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2529/head:pull/2529
PR: https://git.openjdk.java.net/jdk/pull/2529
More information about the hotspot-compiler-dev
mailing list