tree-ssa-pre.c (create_component_ref_by_pieces_1): Drop a zero minimum index only if it is redundant.
* tree-ssa-pre.c (create_component_ref_by_pieces_1) <ARRAY_REF>: Drop a zero minimum index only if it is redundant. From-SVN: r171800
This commit is contained in:
parent
35ca26acc6
commit
d4d73ce26b
4 changed files with 47 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-03-31 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* tree-ssa-pre.c (create_component_ref_by_pieces_1) <ARRAY_REF>: Drop
|
||||
a zero minimum index only if it is redundant.
|
||||
|
||||
2011-03-31 Vladimir Makarov <vmakarov@redhat.com>
|
||||
|
||||
PR rtl-optimization/48381
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2011-03-31 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/opt16.adb: New test.
|
||||
|
||||
2011-03-31 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/defaulted24.C: New.
|
||||
|
|
33
gcc/testsuite/gnat.dg/opt16.adb
Normal file
33
gcc/testsuite/gnat.dg/opt16.adb
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- { dg-do compile }
|
||||
-- { dg-options "-O2 -gnatws" }
|
||||
|
||||
procedure Opt16 is
|
||||
|
||||
generic
|
||||
type T (<>) is private;
|
||||
V, V1 : T;
|
||||
with function F1 (X : T) return T;
|
||||
package GP is
|
||||
R : Boolean := F1 (V) = V1;
|
||||
end GP;
|
||||
|
||||
type AB is array (Boolean range <>) of Boolean;
|
||||
|
||||
begin
|
||||
for I1 in Boolean loop
|
||||
for I2 in Boolean loop
|
||||
declare
|
||||
B1 : Boolean := I1;
|
||||
B2 : Boolean := I2;
|
||||
AB1 : AB (Boolean) := (I1, I2);
|
||||
T : AB (B1 .. B2) := (B1 .. B2 => True);
|
||||
F : AB (B1 .. B2) := (B1 .. B2 => False);
|
||||
|
||||
package P is new GP (AB, AB1, NOT AB1, "NOT");
|
||||
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
end loop;
|
||||
end loop;
|
||||
end;
|
|
@ -2874,8 +2874,11 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
|
|||
return NULL_TREE;
|
||||
if (genop2)
|
||||
{
|
||||
/* Drop zero minimum index. */
|
||||
if (tree_int_cst_equal (genop2, integer_zero_node))
|
||||
tree domain_type = TYPE_DOMAIN (TREE_TYPE (genop0));
|
||||
/* Drop zero minimum index if redundant. */
|
||||
if (integer_zerop (genop2)
|
||||
&& (!domain_type
|
||||
|| integer_zerop (TYPE_MIN_VALUE (domain_type))))
|
||||
genop2 = NULL_TREE;
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue