From: Richard Guenther Date: Sun, 27 Jun 2010 11:22:06 +0000 (+0000) Subject: re PR tree-optimization/44683 (Optimization bug with copysign builtin) X-Git-Tag: releases/gcc-4.4.5~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2683009ace15891e169958377a813bc38e581c03;p=thirdparty%2Fgcc.git re PR tree-optimization/44683 (Optimization bug with copysign builtin) 2010-06-27 Richard Guenther 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b96a52292833..e4905b830911 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-06-27 Richard Guenther + + 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 PR target/39690 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 92bbd85c0aa9..0c946eaa9ffc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-27 Richard Guenther + + PR tree-optimization/44683 + * gcc.c-torture/execute/pr44683.c: New testcase. + 2010-06-22 Jakub Jelinek 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 index 000000000000..d0fd446f004f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44683.c @@ -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; +} + diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 3f9e1e8e2929..aaa9436d3b33 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -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;