re PR middle-end/55863 (Fails to fold (i + 2) - (i + 1) to 1)
2013-01-04 Richard Biener <rguenther@suse.de> PR middle-end/55863 * fold-const.c (split_tree): Undo -X - 1 to ~X folding for reassociation. * gcc.dg/fold-reassoc-2.c: New testcase. From-SVN: r194899
This commit is contained in:
parent
db59befb09
commit
3068819a3a
|
@ -1,3 +1,9 @@
|
|||
2013-01-04 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/55863
|
||||
* fold-const.c (split_tree): Undo -X - 1 to ~X folding for
|
||||
reassociation.
|
||||
|
||||
2013-01-03 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
|
||||
|
||||
PR target/53789
|
||||
|
|
|
@ -821,6 +821,13 @@ split_tree (tree in, enum tree_code code, tree *conp, tree *litp,
|
|||
if (neg_var_p)
|
||||
var = negate_expr (var);
|
||||
}
|
||||
else if (TREE_CODE (in) == BIT_NOT_EXPR
|
||||
&& code == PLUS_EXPR)
|
||||
{
|
||||
/* -X - 1 is folded to ~X, undo that here. */
|
||||
*minus_litp = build_one_cst (TREE_TYPE (in));
|
||||
var = negate_expr (TREE_OPERAND (in, 0));
|
||||
}
|
||||
else if (TREE_CONSTANT (in))
|
||||
*conp = in;
|
||||
else
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2013-01-04 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/55863
|
||||
* gcc.dg/fold-reassoc-2.c: New testcase.
|
||||
|
||||
2013-01-04 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/55763
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-original" } */
|
||||
|
||||
int foo (int i)
|
||||
{
|
||||
return (i + 2) - (i + 1);
|
||||
}
|
||||
int bar (int i)
|
||||
{
|
||||
return (i + 2) + ~i;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "return 1;" "original" } } */
|
||||
/* { dg-final { cleanup-tree-dump "original" } } */
|
Loading…
Reference in New Issue