[12] RFR (S): 8215757: C2: PhaseIdealLoop::spinup() computes wrong post-dominating point

Roland Westrelin rwestrel at redhat.com
Tue Jan 15 13:38:11 UTC 2019

Hi Vladimir K & Vladimir I,

>> And that's the other way to fix the crash: initiate new PhaseIdealLoop iteration right away if any strip mined loops are 
>> introduced.
> Got it. So the issue is that strip mining invalidated IDOM information generated at the beginning of 
> PhaseIdealLoop::build_and_optimize().

I don't think that's accurate. The idom is changed when a loop limit
check is inserted (so that's unrelated to strip mining AFAICT). As
Vladimir said, when the loop limit check is inserted, the idom of the
region is fixed by:

    Node* nrdom = dom_lca(ridom, new_iff);
    set_idom(rgn, nrdom, dom_depth(rgn));

which does:

  Node *dom_lca( Node *n1, Node *n2 ) const {
    return find_non_split_ctrl(dom_lca_internal(n1, n2));

and because of the find_non_split_ctrl(), the idom is set to a region
rather than an if.

That's broken and I'm confused as to why a straightforward change of the
logic above:

diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp
--- a/src/hotspot/share/opto/loopPredicate.cpp
+++ b/src/hotspot/share/opto/loopPredicate.cpp
@@ -160,7 +160,7 @@
   // When called from beautify_loops() idom is not constructed yet.
   if (_idom != NULL) {
     Node* ridom = idom(rgn);
-    Node* nrdom = dom_lca(ridom, new_iff);
+    Node* nrdom = dom_lca_internal(ridom, new_iff);
     set_idom(rgn, nrdom, dom_depth(rgn));
is not good enough.


More information about the hotspot-compiler-dev mailing list