On 10/18/2021 2:17 AM, Aldy Hernandez wrote:


On 10/18/21 12:52 AM, Jeff Law wrote:


On 10/8/2021 9:12 AM, Aldy Hernandez via Gcc-patches wrote:
The following patch converts the strlen pass from evrp to ranger,
leaving DOM as the last remaining user.
So is there any reason why we can't convert DOM as well?   DOM's use of EVRP is pretty limited.  You've mentioned FP bits before, but my recollection is those are not part of the EVRP analysis DOM uses. Hell, give me a little guidance and I'll do the work...

Not only will I take you up on that offer, but I can provide 90% of the work.  Here be dragons, though (well, for me, maybe not for you ;-)).
[ ... ]
So the failure I see it a bootstrap comparison failure affecting omp-expand.c and cp/cp-gimplify.c.  We end up generating different code with and without debug symbols.

The real differences start in dom2 (I guess that's a positive since that's the pass the patch changes).  Stripping away the DEBUG statements in the IL, then diffing the .dom2 output shows this:
*************** Optimizing block #35
*** 2133,2138 ****
--- 2133,2139 ----
  LKUP STMT loop_1045 = PHI <single_outer_732, single_outer_732>
  2>>> STMT loop_1045 = PHI <single_outer_732, single_outer_732>
  <<<< STMT loop_1045 = PHI <single_outer_732, single_outer_732>
+   Replaced 'loop_1045' with variable 'single_outer_732'
   Registering value_relation (loop_1045 == single_outer_732) (bb35) at loop_1045 = PHI <single_outer_732(32), single_outer_732(34)>
  Optimizing statement if (loop_1045 != 0B)
    Replaced 'loop_1045' with variable 'single_outer_732'
*************** Optimizing statement if (loop_1045 != 0B
*** 2140,2156 ****
  Visiting conditional with predicate: if (single_outer_732 != 0B)

  With known ranges
!       single_outer_732: struct loop * [1B, +INF]

! Predicate evaluates to: 1
! 0>>> COPY loop_1045 = 0B
! <<<< COPY loop_1045 = 0B


  Optimizing block #565

! 1>>> STMT 1 = loop_1045 ne_expr 0B
! 1>>> STMT 0 = loop_1045 eq_expr 0B


  Optimizing block #36
--- 2141,2158 ----
  Visiting conditional with predicate: if (single_outer_732 != 0B)

  With known ranges
!       single_outer_732: struct loop * VARYING

! Predicate evaluates to: DON'T KNOW
! LKUP STMT single_outer_732 ne_expr 0B
! 0>>> COPY single_outer_732 = 0B
! <<<< COPY single_outer_732 = 0B


  Optimizing block #565

! 1>>> STMT 1 = single_outer_732 ne_expr 0B
! 1>>> STMT 0 = single_outer_732 eq_expr 0B


  Optimizing block #36


The first hunk is the stage1 compiler, the second is the stage2 compiler.  Stage2 does a replacement of the LHS with the RHS of a generate PHI.  But the stage1 compiler is able to statically compute a test while the stage2 compiler is not.  And things cascade from there.

I think all that means there's some kind of inconsistency in the const_and_copies table between the stage1 and stage2 compilers.  Not sure how that's possible, but that's what the signs point to.

jeff

Reply via email to