OSDN Git Service

Fix PR45297: handle ADDR_EXPR in interpret_rhs_expr as in follow_ssa_edge_expr.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Dec 2010 20:13:11 +0000 (20:13 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Dec 2010 20:13:11 +0000 (20:13 +0000)
2010-12-01  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/45297
* tree-scalar-evolution.c (interpret_rhs_expr): Handle ADDR_EXPR
with MEM_REFs as POINTER_PLUS_EXPR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167390 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-scalar-evolution.c

index 5dd3477..ec354d6 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-02  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/45297
+       * tree-scalar-evolution.c (interpret_rhs_expr): Handle ADDR_EXPR
+       with MEM_REFs as POINTER_PLUS_EXPR.
+
 2010-12-02  Joseph Myers  <joseph@codesourcery.com>
 
        * config/i386/linux.h, config/m32r/linux.h, config/m68k/linux.h,
index 8a5797e..4a4bda9 100644 (file)
@@ -1715,12 +1715,22 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
          return chrec_convert (type, analyze_scalar_evolution (loop, rhs1),
                                at_stmt);
        }
-
-      return chrec_dont_know;
     }
 
   switch (code)
     {
+    case ADDR_EXPR:
+      /* Handle &MEM[ptr + CST] which is equivalent to POINTER_PLUS_EXPR.  */
+      if (TREE_CODE (TREE_OPERAND (rhs1, 0)) != MEM_REF)
+       {
+         res = chrec_dont_know;
+         break;
+       }
+
+      rhs2 = TREE_OPERAND (TREE_OPERAND (rhs1, 0), 1);
+      rhs1 = TREE_OPERAND (TREE_OPERAND (rhs1, 0), 0);
+      /* Fall through.  */
+
     case POINTER_PLUS_EXPR:
       chrec1 = analyze_scalar_evolution (loop, rhs1);
       chrec2 = analyze_scalar_evolution (loop, rhs2);