summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-08-14 15:07:43 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-08-14 15:07:43 +0000
commit1a15bfdcdc93b45ddeb4701fa1d1d587305996fc (patch)
treeeed72790b8da7b6241bcc9287b383b2ba96bc6fd
parent065312cfdd633dae0cf725104e07a2c05e2747e7 (diff)
downloadgcc-1a15bfdcdc93b45ddeb4701fa1d1d587305996fc.tar.gz
ipa-prop.c (compute_complex_pass_through): If we cannot compute a non-varying offset for IPA_JF_ANCESTOR punt.
2009-08-14 Richard Guenther <rguenther@suse.de> * ipa-prop.c (compute_complex_pass_through): If we cannot compute a non-varying offset for IPA_JF_ANCESTOR punt. * gcc.c-torture/execute/20090814-1.c: New testcase. From-SVN: r150757
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ipa-prop.c5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20090814-1.c23
4 files changed, 36 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 125b127d39b..6aa16eff0de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-14 Richard Guenther <rguenther@suse.de>
+
+ * ipa-prop.c (compute_complex_pass_through): If we cannot
+ compute a non-varying offset for IPA_JF_ANCESTOR punt.
+
2009-08-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* c-lex.c (c_lex_with_flags): Increase size of local variable
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 2842088d8f1..23710067ee7 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -377,7 +377,10 @@ compute_complex_pass_through (struct ipa_node_params *info,
type = TREE_TYPE (op1);
op1 = get_ref_base_and_extent (op1, &offset, &size, &max_size);
- if (TREE_CODE (op1) != INDIRECT_REF)
+ if (TREE_CODE (op1) != INDIRECT_REF
+ /* If this is a varying address, punt. */
+ || max_size == -1
+ || max_size != size)
return;
op1 = TREE_OPERAND (op1, 0);
if (TREE_CODE (op1) != SSA_NAME
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ab3876debb3..765ae6354cc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-14 Richard Guenther <rguenther@suse.de>
+
+ * gcc.c-torture/execute/20090814-1.c: New testcase.
+
2009-08-14 David Edelsohn <edelsohn@gnu.org>
* gcc.dg/graphite/graphite_autopar: Move to libgomp testsuite.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20090814-1.c b/gcc/testsuite/gcc.c-torture/execute/20090814-1.c
new file mode 100644
index 00000000000..857393b5760
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20090814-1.c
@@ -0,0 +1,23 @@
+int __attribute__((noinline))
+bar (int *a)
+{
+ return *a;
+}
+int i;
+int __attribute__((noinline))
+foo (int (*a)[2])
+{
+ return bar (&(*a)[i]);
+}
+
+extern void abort (void);
+int a[2];
+int main()
+{
+ a[0] = -1;
+ a[1] = 42;
+ i = 1;
+ if (foo (&a) != 42)
+ abort ();
+ return 0;
+}