]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-prop.c (compute_complex_pass_through): If we cannot compute a non-varying offset...
authorRichard Guenther <rguenther@suse.de>
Fri, 14 Aug 2009 15:07:43 +0000 (15:07 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 14 Aug 2009 15:07:43 +0000 (15:07 +0000)
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

gcc/ChangeLog
gcc/ipa-prop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20090814-1.c [new file with mode: 0644]

index 125b127d39bbf2276cdae5b9c8b408da7b99c4df..6aa16eff0de8192744f78f4d8038621217e299d3 100644 (file)
@@ -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
index 2842088d8f1b9d075c6f9456170edab6a06b50c7..23710067ee7852da72f5c9ef51279bc4c9bd113a 100644 (file)
@@ -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
index ab3876debb3b4b22a9daaa52f280ba47416d4962..765ae6354ccffcd41ad674a46f68160cd7935ff6 100644 (file)
@@ -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 (file)
index 0000000..857393b
--- /dev/null
@@ -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;
+}