RFR(S): 8231291: C2: loop opts before EA should maximally unroll loops

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Mon Jan 13 14:00:47 UTC 2020


>> Do you know why RootNode::Ideal() isn't called during IGVN pass after
>> parsing is over?
> 
> The root node would need to be enqueued in the igvn worklist during
> parsing. The code pattern when an HaltNode is added to the graph is to
> use add_req() which doesn't cause the root node to be put on the igvn
> worklist.

I think the right way to fix the bug is to transform HaltNode after it 
is added to RootNode (e.g., as done in AllocateArrayNode::Ideal() [1]).
In case HaltNode is eliminiated, RootNode should be put on worklist.

I'm fine with leaving your change in GraphKit::must_be_not_null() as is.
With the shortcut it becomes easier to read without double-checking how 
Opaque4 behaves.

I quickly looked through other places with the same idiom and 
MemNode::Ideal_common() looks suspicious [3]. I don't see how it can 
suffer from the same problem, but it would be nice to fix it as well. 
I'm fine with filing a separate bug for it.

Best regards,
Vladimir Ivanov

[1] 
http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/callnode.cpp#l1445

[2] ifnode.cpp:1234:         igvn->C->root()->add_req(halt);
     loopTransform.cpp:1271:  C->root()->add_req(halt);
     loopTransform.cpp:2434:  C->root()->add_req(halt);
     callnode.cpp:1447:       phase->C->root()->add_req(halt);
     loopnode.cpp:3676:       C->root()->add_req(halt);
     memnode.cpp:343:         phase->C->root()->add_req(halt);
     graphKit.cpp:1417:       C->root()->add_req(halt);

[3] 
http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/memnode.cpp#l342


More information about the hotspot-compiler-dev mailing list