From bc6e9db4169f97f73385800ebd82afeb4caeebed Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 26 Jan 2016 12:05:22 +0000 Subject: [PATCH] re PR tree-optimization/69467 (Pattern X * C1 CMP 0 to X CMP 0 causes performance drop on 32-bit x86.) 2016-01-26 Richard Biener PR middle-end/69467 * match.pd: Guard X * CST CMP 0 pattern with single_use. From-SVN: r232821 --- gcc/ChangeLog | 5 +++++ gcc/match.pd | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65b1fb359cf3..ca46ff0bfa16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-01-26 Richard Biener + + PR middle-end/69467 + * match.pd: Guard X * CST CMP 0 pattern with single_use. + 2016-01-26 Richard Biener PR tree-optimization/69452 diff --git a/gcc/match.pd b/gcc/match.pd index 069d27183995..5f2821570127 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1821,12 +1821,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (for cmp (simple_comparison) scmp (swapped_simple_comparison) (simplify - (cmp (mult @0 INTEGER_CST@1) integer_zerop@2) + (cmp (mult@3 @0 INTEGER_CST@1) integer_zerop@2) /* Handle unfolded multiplication by zero. */ (if (integer_zerop (@1)) (cmp @1 @2) (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) - && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))) + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0)) + && single_use (@3)) /* If @1 is negative we swap the sense of the comparison. */ (if (tree_int_cst_sgn (@1) < 0) (scmp @0 @2) -- 2.47.2