RFR: 8319372: C2 compilation fails with "Bad immediate dominator info" [v2]
Roland Westrelin
roland at openjdk.org
Wed Nov 29 13:25:30 UTC 2023
> I included the test case from 8318690 because the cause of the failure
> is similar, the fix I propose applies to both. If this fix goes in
> then 8318690 can be closed as duplicate of this one.
>
> In both cases, a `CastII`'s type is narrowed because it is control
> dependent on a condition that tests the input of the `CastII` (code in
> `CastIINode::Value()`). In both cases, that `CastII` is input to a
> range check `CastII`. Predication leaves that second `CastII` in the
> loop body but the range check that guards it is replaced by
> predicates. The difference in the 2 test cases is where the first
> `CastII` comes from: `PhiNode::Ideal()` in one case,
> `PhaseIdealLoop::try_sink_out_of_loop()` in the other. The narrowed
> type of the first `CastII` conflicts with the type of the range check
> `CastII` and that causes that one to become top. The path where that
> `CastII` is is unreachable but c2 can't prove it. The inconsistency
> causes the asserts.
>
> To fix this we would need to prove that the path where the `CastII`
> nodes are is dead and for that we would need to prove that the
> condition that guards that path and at least one of the predicates
> can't be true at the same time. While it may be feasible, that seems
> like a lot of extra complexity.
>
> Instead I propose removing the logic in `CastIINode::Value()`
> entirely. I went back to the change that introduced it and, as I
> understand, it was added as an attempt to detect and remove useless
> `CastII` nodes. There was no correctness issue involved AFAICT.
Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
review
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/16844/files
- new: https://git.openjdk.org/jdk/pull/16844/files/eed99722..16877d36
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=16844&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=16844&range=00-01
Stats: 60 lines in 3 files changed: 60 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/16844.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16844/head:pull/16844
PR: https://git.openjdk.org/jdk/pull/16844
More information about the hotspot-compiler-dev
mailing list