Commit 297db279 by Richard Biener Committed by Richard Biener

tree-ssa-reassoc.c (should_break_up_subtract): Also break up if the use is in USE - X.

2017-08-03  Richard Biener  <rguenther@suse.de>

	* tree-ssa-reassoc.c (should_break_up_subtract): Also break
	up if the use is in USE - X.

	* gcc.dg/tree-ssa/reassoc-23.c: Adjust to fool early folding
	and CSE.

From-SVN: r250855
parent 75560de5
2017-08-03 Richard Biener <rguenther@suse.de>
* tree-ssa-reassoc.c (should_break_up_subtract): Also break
up if the use is in USE - X.
2017-08-03 Alexander Monakov <amonakov@ispras.ru> 2017-08-03 Alexander Monakov <amonakov@ispras.ru>
* toplev.c (dumpfile.h): New include. * toplev.c (dumpfile.h): New include.
......
2017-08-03 Richard Biener <rguenther@suse.de> 2017-08-03 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/reassoc-23.c: Adjust to fool early folding
and CSE.
2017-08-03 Richard Biener <rguenther@suse.de>
PR middle-end/81148 PR middle-end/81148
* c-c++-common/ubsan/pr81148.c: New testcase. * c-c++-common/ubsan/pr81148.c: New testcase.
......
...@@ -6,9 +6,10 @@ foo(unsigned int a, unsigned int b, unsigned int c, unsigned int d, ...@@ -6,9 +6,10 @@ foo(unsigned int a, unsigned int b, unsigned int c, unsigned int d,
unsigned int e, unsigned int f, unsigned int g, unsigned int h) unsigned int e, unsigned int f, unsigned int g, unsigned int h)
{ {
/* Should be transformed into e = 20 */ /* Should be transformed into e = 20 */
unsigned int i = (a + 9) + (c + 8); unsigned int i = (a + 9);
unsigned int j = (-c + 1) + (-a + 2); unsigned int j = (-c + 1);
i += (c + 8);
j += (-a + 2);
e = i + j; e = i + j;
return e; return e;
} }
......
...@@ -4729,6 +4729,8 @@ should_break_up_subtract (gimple *stmt) ...@@ -4729,6 +4729,8 @@ should_break_up_subtract (gimple *stmt)
&& (immusestmt = get_single_immediate_use (lhs)) && (immusestmt = get_single_immediate_use (lhs))
&& is_gimple_assign (immusestmt) && is_gimple_assign (immusestmt)
&& (gimple_assign_rhs_code (immusestmt) == PLUS_EXPR && (gimple_assign_rhs_code (immusestmt) == PLUS_EXPR
|| (gimple_assign_rhs_code (immusestmt) == MINUS_EXPR
&& gimple_assign_rhs1 (immusestmt) == lhs)
|| gimple_assign_rhs_code (immusestmt) == MULT_EXPR)) || gimple_assign_rhs_code (immusestmt) == MULT_EXPR))
return true; return true;
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment