RFR: 8280123: C2: Infinite loop in CMoveINode::Ideal during IGVN
Christian Hagedorn
chagedorn at openjdk.java.net
Thu Jan 20 08:09:55 UTC 2022
On Tue, 18 Jan 2022 18:57:02 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> There's a discrepancy between `CMoveNode::Ideal()` and `CMoveINode::Ideal()` in the way how constants are detected:
> the former looks for `Con` nodes (`in(IfFalse)->is_Con()`) while the latter checks node types (e.g., `phase->type(in(IfFalse)) == TypeInt::ZERO`). It leads to infinite loop during IGVN (where `CMoveNode::Ideal()` and `CMoveINode::Ideal()` repeatedly rotate `CMoveI` node) because `CMoveNode::Ideal()` don't consider `CastII` to a constant as a constant while `CMoveINode::Ideal()` does.
>
> The fix migrates `CMoveNode::Ideal()` away from `Node::is_Con()` to node types.
>
> Testing: hs-tier1 - hs-tier4
Looks good!
src/hotspot/share/opto/movenode.cpp line 95:
> 93: // Canonicalize the node by moving constants to the right input.
> 94: if (phase->type(in(IfFalse))->singleton() && !phase->type(in(IfTrue))->singleton()) {
> 95: if (in(Condition)->is_Bool()) {
Could be merged into a single `if`.
-------------
Marked as reviewed by chagedorn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7133
More information about the hotspot-compiler-dev
mailing list