]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move NOP stripping in SCEV analysis
authorRichard Biener <rguenther@suse.de>
Tue, 25 Oct 2022 08:04:56 +0000 (10:04 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 25 Oct 2022 09:15:25 +0000 (11:15 +0200)
The following moves a pair of STRIP_USELESS_TYPE_CONVERSIONS to
where it belongs and adds a comment on why we handle GENERIC
there at all.

* tree-scalar-evolution.cc (follow_ssa_edge_expr): Move
STRIP_USELESS_TYPE_CONVERSIONS to where it matters.

gcc/tree-scalar-evolution.cc

index 9f30f78cb5d9838db36bfd188df2f24314e75ed3..8b92709432412da08ead9297a99de0a6184b5361 100644 (file)
@@ -1214,6 +1214,8 @@ tail_recurse:
     {
       code = TREE_CODE (expr);
       type = TREE_TYPE (expr);
+      /* Via follow_ssa_edge_inner_loop_phi we arrive here with the
+        GENERIC scalar evolution of the inner loop.  */
       switch (code)
        {
        CASE_CONVERT:
@@ -1224,6 +1226,8 @@ tail_recurse:
        case MINUS_EXPR:
          rhs0 = TREE_OPERAND (expr, 0);
          rhs1 = TREE_OPERAND (expr, 1);
+         STRIP_USELESS_TYPE_CONVERSION (rhs0);
+         STRIP_USELESS_TYPE_CONVERSION (rhs1);
          break;
        default:
          rhs0 = expr;
@@ -1260,8 +1264,6 @@ tail_recurse:
     case PLUS_EXPR:
     case MINUS_EXPR:
       /* This case is under the form "rhs0 +- rhs1".  */
-      STRIP_USELESS_TYPE_CONVERSION (rhs0);
-      STRIP_USELESS_TYPE_CONVERSION (rhs1);
       if (TREE_CODE (rhs0) == SSA_NAME
          && (TREE_CODE (rhs1) != SSA_NAME || code == MINUS_EXPR))
        {