OSDN Git Service

2014-05-07 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 May 2014 07:59:26 +0000 (07:59 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 May 2014 07:59:26 +0000 (07:59 +0000)
Backport from mainline
2013-08-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/58246
* tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Properly
handle the dominance check inside a basic-block.

* gcc.dg/torture/pr58246.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@210141 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr58246.c [new file with mode: 0644]
gcc/tree-ssa-dce.c

index 030f3ff..804f323 100644 (file)
@@ -1,3 +1,12 @@
+2014-05-07  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2013-08-29  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58246
+       * tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Properly
+       handle the dominance check inside a basic-block.
+
 2014-05-06  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
 2014-05-06  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index 6b5f1f5..811cff5 100644 (file)
@@ -1,3 +1,11 @@
+2014-05-07  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2013-08-29  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58246
+       * gcc.dg/torture/pr58246.c: New testcase.
+
 2014-05-06  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
 2014-05-06  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/torture/pr58246.c b/gcc/testsuite/gcc.dg/torture/pr58246.c
new file mode 100644 (file)
index 0000000..5417abf
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+int a, b; 
+
+int main ()
+{
+  int t[2] = {1,1};
+
+  for (a = 0; a < 2; a++)
+    {
+      b ^= t[a];
+      t[a] = t[1] = 0;
+    }
+
+  if (b != 1)
+    abort ();
+
+  return 0;
+}
index ace9ef9..d99e771 100644 (file)
@@ -576,6 +576,11 @@ mark_aliased_reaching_defs_necessary_1 (ao_ref *ref, tree vdef, void *data)
                      in the references (gcc.c-torture/execute/pr42142.c).
                      The simplest way is to check if the kill dominates
                      the use.  */
                      in the references (gcc.c-torture/execute/pr42142.c).
                      The simplest way is to check if the kill dominates
                      the use.  */
+                  /* But when both are in the same block we cannot
+                     easily tell whether we came from a backedge
+                     unless we decide to compute stmt UIDs
+                     (see PR58246).  */
+                  && (basic_block) data != gimple_bb (def_stmt)
                   && dominated_by_p (CDI_DOMINATORS, (basic_block) data,
                                      gimple_bb (def_stmt))
                   && operand_equal_p (ref->ref, lhs, 0))
                   && dominated_by_p (CDI_DOMINATORS, (basic_block) data,
                                      gimple_bb (def_stmt))
                   && operand_equal_p (ref->ref, lhs, 0))