* [PATCH] Fix PR44683
@ 2010-06-27 15:26 Richard Guenther
0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2010-06-27 15:26 UTC (permalink / raw)
To: gcc-patches
This fixes PR44683 - we can't just record equivalences on the
false edge when the predicate is NE_EXPR, instead we have to
check the predicate of the inverted condition, otherwise we'd
get x != 0.0 wrong wrt signed zeros.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
and the branches.
Richard.
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.
Index: gcc/tree-ssa-dom.c
===================================================================
*** gcc/tree-ssa-dom.c (revision 161455)
--- gcc/tree-ssa-dom.c (working copy)
*************** record_edge_info (basic_block bb)
*** 1635,1641 ****
edge_info = allocate_edge_info (false_edge);
record_conditions (edge_info, inverted, cond);
! if (code == NE_EXPR)
{
edge_info->lhs = op1;
edge_info->rhs = op0;
--- 1635,1641 ----
edge_info = allocate_edge_info (false_edge);
record_conditions (edge_info, inverted, cond);
! if (TREE_CODE (inverted) == EQ_EXPR)
{
edge_info->lhs = op1;
edge_info->rhs = op0;
*************** record_edge_info (basic_block bb)
*** 1662,1668 ****
edge_info = allocate_edge_info (false_edge);
record_conditions (edge_info, inverted, cond);
! if (TREE_CODE (cond) == NE_EXPR)
{
edge_info->lhs = op0;
edge_info->rhs = op1;
--- 1662,1668 ----
edge_info = allocate_edge_info (false_edge);
record_conditions (edge_info, inverted, cond);
! if (TREE_CODE (inverted) == EQ_EXPR)
{
edge_info->lhs = op0;
edge_info->rhs = op1;
Index: gcc/testsuite/gcc.c-torture/execute/pr44683.c
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/pr44683.c (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/pr44683.c (revision 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;
+ }
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-27 11:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-27 15:26 [PATCH] Fix PR44683 Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).