]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-ccp.c (valid_lattice_transition): Clarify comment about transition from...
authorRichard Guenther <rguenther@suse.de>
Thu, 19 Jul 2012 11:48:46 +0000 (11:48 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 19 Jul 2012 11:48:46 +0000 (11:48 +0000)
2012-07-19  Richard Guenther  <rguenther@suse.de>
Eric Botcazou  <ebotcazou@adacore.com>

* tree-ssa-ccp.c (valid_lattice_transition): Clarify comment
about transition from invariant to known bits.
(likely_value): Addresses with UNDEFINED components are
UNDEFINED.

* gnat.dg/loop_optimization11.adb: New testcase.
* gnat.dg/loop_optimization11_pkg.ads: Likewise.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
From-SVN: r189650

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/loop_optimization11.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_optimization11_pkg.ads [new file with mode: 0644]
gcc/tree-ssa-ccp.c

index c4b114ef254b82c264a937f0feb11b51e9678f43..4e8816a79e9c0abbed742ea88a28e57bd2c04990 100644 (file)
@@ -1,3 +1,11 @@
+2012-07-19  Richard Guenther  <rguenther@suse.de>
+       Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-ssa-ccp.c (valid_lattice_transition): Clarify comment
+       about transition from invariant to known bits.
+       (likely_value): Addresses with UNDEFINED components are
+       UNDEFINED.
+
 2012-07-19  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/53970
index 32ed483ca88b346bdf0b9bb4b2e29f75b4fe8fb3..dee868fe17ed3809d25bec194d3bfd9f83a3cf55 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-19  Richard Guenther  <rguenther@suse.de>
+       Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/loop_optimization11.adb: New testcase.
+       * gnat.dg/loop_optimization11_pkg.ads: Likewise.
+
 2012-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
            Jason Merrill  <jason@redhat.com>
 
diff --git a/gcc/testsuite/gnat.dg/loop_optimization11.adb b/gcc/testsuite/gnat.dg/loop_optimization11.adb
new file mode 100644 (file)
index 0000000..e4e27d4
--- /dev/null
@@ -0,0 +1,19 @@
+-- { dg-do compile }\r
+-- { dg-options "-O" }\r
+\r
+with Loop_Optimization11_Pkg; use Loop_Optimization11_Pkg;\r
+\r
+procedure Loop_Optimization11 is\r
+   Arr : array (Prot, Mem) of Integer := (others => (others => 0));\r
+begin\r
+   Put_Line (Img (0) & " ");\r
+   for I in Arr'Range (1) loop\r
+      for J in Arr'Range (2) loop\r
+         declare\r
+            Elem : Integer renames Arr (I, J);\r
+         begin\r
+            Put_Line (Img (Elem));\r
+         end;\r
+      end loop;\r
+   end loop;\r
+end;\r
diff --git a/gcc/testsuite/gnat.dg/loop_optimization11_pkg.ads b/gcc/testsuite/gnat.dg/loop_optimization11_pkg.ads
new file mode 100644 (file)
index 0000000..f4248e5
--- /dev/null
@@ -0,0 +1,11 @@
+package Loop_Optimization11_Pkg is\r
+\r
+   function Img (X : Integer) return String;\r
+\r
+   procedure Put_Line (Data : String);\r
+\r
+   type Prot is (Execute, Execute_Read, Execute_Read_Write);\r
+\r
+   type Mem is (Mem_Image, Mem_Mapped, Mem_Private, Unknown);\r
+\r
+end Loop_Optimization11_Pkg;\r
index 6dc30e148cd1c8f9b7beb20f97156f6b9422009d..3f88f39f0963b1fcc3ed9bb9b5afeb486ad6a50c 100644 (file)
@@ -405,7 +405,8 @@ valid_lattice_transition (prop_value_t old_val, prop_value_t new_val)
 
   /* Now both lattice values are CONSTANT.  */
 
-  /* Allow transitioning from &x to &x & ~3.  */
+  /* Allow transitioning from PHI <&x, not executable> == &x
+     to PHI <&x, &y> == common alignment.  */
   if (TREE_CODE (old_val.value) != INTEGER_CST
       && TREE_CODE (new_val.value) == INTEGER_CST)
     return true;
@@ -648,6 +649,11 @@ likely_value (gimple stmt)
             the undefined operand may be promoted.  */
          return UNDEFINED;
 
+       case ADDR_EXPR:
+         /* If any part of an address is UNDEFINED, like the index
+            of an ARRAY_EXPR, then treat the result as UNDEFINED.  */
+         return UNDEFINED;
+
        default:
          ;
        }