Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard.
2018-01-08 Richard Biener <rguent...@suse.de> PR middle-end/83517 * match.pd ((t * 2) / 2) -> t): Add missing :c. * gcc.dg/pr83517.c: New testcase. Index: gcc/match.pd =================================================================== --- gcc/match.pd (revision 256275) +++ gcc/match.pd (working copy) @@ -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))) Index: gcc/testsuite/gcc.dg/pr83517.c =================================================================== --- gcc/testsuite/gcc.dg/pr83517.c (nonexistent) +++ gcc/testsuite/gcc.dg/pr83517.c (working copy) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-original" } */ + +int test(int x) +{ + return (x+x)/x; +} + +/* { dg-final { scan-tree-dump "return 2;" "original" } } */