]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/44683 (Optimization bug with copysign builtin)
authorRichard Guenther <rguenther@suse.de>
Sun, 27 Jun 2010 11:22:06 +0000 (11:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 27 Jun 2010 11:22:06 +0000 (11:22 +0000)
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.

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

From-SVN: r161469

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

index b96a52292833fa0680ab9c7ff0b5609b6e32c98a..e4905b830911700df4d5057b8c40a684e6742b3b 100644 (file)
@@ -1,3 +1,9 @@
+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-21  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR target/39690
index 92bbd85c0aa9cc68bcdc958e9ab390335e9b9ade..0c946eaa9ffc7a513eb720dd7474c9f1f5f7b424 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-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/44627
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 3f9e1e8e2929480569683b0b23c08f76702acf73..aaa9436d3b3357bd9cb56730af02bf1946ad94e2 100644 (file)
@@ -1764,7 +1764,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;
@@ -1791,7 +1791,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;