about transition from invariant to known bits.
(likely_value): Addresses with UNDEFINED components are UNDEFINED.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189679
138bc75d-0d04-0410-961f-
82ee72b054a4
+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 Jakub Jelinek <jakub@redhat.com>
PR middle-end/54017
+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-19 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr38.adb: New test.
--- /dev/null
+-- { 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
--- /dev/null
+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
/* 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;
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:
;
}