2010-06-27 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Jun 2010 11:16:46 +0000 (11:16 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Jun 2010 11:16:46 +0000 (11:16 +0000)
PR tree-optimization/44683
* tree-ssa-dom.c (record_edge_info): Record equivalences for the
false edge from the inverted condition.

* gcc.c-torture/execute/pr44683.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161467 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr44683.c [new file with mode: 0644]
gcc/tree-ssa-dom.c

index 1281858..5a6908c 100644 (file)
@@ -1,5 +1,11 @@
 2010-06-27  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/44683
+       * tree-ssa-dom.c (record_edge_info): Record equivalences for the
+       false edge from the inverted condition.
+
+2010-06-27  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/44684
        * tree-ssa-alias.c (refs_may_alias_p_1): Allow SSA name refs.
        (stmt_may_clobber_ref_p_1): Do not bother to call the oracle
index 04fad30..75a47a2 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-27  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44683
+       * gcc.c-torture/execute/pr44683.c: New testcase.
+
 2010-06-27  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/noreturn3.ad[sb]: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44683.c b/gcc/testsuite/gcc.c-torture/execute/pr44683.c
new file mode 100644 (file)
index 0000000..d0fd446
--- /dev/null
@@ -0,0 +1,18 @@
+int __attribute__((noinline,noclone))
+copysign_bug (double x)
+{
+  if (x != 0.0 && (x * 0.5 == x))
+    return 1;
+  if (__builtin_copysign(1.0, x) < 0.0)
+    return 2;
+  else
+    return 3;
+}
+int main(void)
+{
+  double x = -0.0;
+  if (copysign_bug (x) != 2)
+    __builtin_abort ();
+  return 0;
+}
+
index d15df31..6833820 100644 (file)
@@ -1635,7 +1635,7 @@ record_edge_info (basic_block bb)
               edge_info = allocate_edge_info (false_edge);
               record_conditions (edge_info, inverted, cond);
 
-              if (code == NE_EXPR)
+              if (TREE_CODE (inverted) == EQ_EXPR)
                 {
                   edge_info->lhs = op1;
                   edge_info->rhs = op0;
@@ -1662,7 +1662,7 @@ record_edge_info (basic_block bb)
               edge_info = allocate_edge_info (false_edge);
               record_conditions (edge_info, inverted, cond);
 
-              if (TREE_CODE (cond) == NE_EXPR)
+              if (TREE_CODE (inverted) == EQ_EXPR)
                 {
                   edge_info->lhs = op0;
                   edge_info->rhs = op1;