Commit 55d84e61 by Richard Biener Committed by Richard Biener

re PR tree-optimization/83517 (Missed optimization in math expression: (x+x)/x == 2)

2018-01-08  Richard Biener  <rguenther@suse.de>

	PR middle-end/83517
	* match.pd ((t * 2) / 2) -> t): Add missing :c.

	* gcc.dg/pr83517.c: New testcase.

From-SVN: r256328
parent 2af5fc62
2018-01-08 Richard Biener <rguenther@suse.de>
PR middle-end/83517
* match.pd ((t * 2) / 2) -> t): Add missing :c.
2018-01-06 Aldy Hernandez <aldyh@redhat.com>
PR middle-end/81897
......
......@@ -510,7 +510,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Simplify (t * 2) / 2) -> t. */
(for div (trunc_div ceil_div floor_div round_div exact_div)
(simplify
(div (mult @0 @1) @1)
(div (mult:c @0 @1) @1)
(if (ANY_INTEGRAL_TYPE_P (type)
&& TYPE_OVERFLOW_UNDEFINED (type))
@0)))
......
2018-01-08 Richard Biener <rguenther@suse.de>
PR middle-end/83517
* gcc.dg/pr83517.c: New testcase.
2018-01-06 Aldy Hernandez <aldyh@redhat.com>
PR middle-end/81897
......
/* { dg-do compile } */
/* { dg-options "-fdump-tree-original" } */
int test(int x)
{
return (x+x)/x;
}
/* { dg-final { scan-tree-dump "return 2;" "original" } } */
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