This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/69467] [6 Regression] Pattern X * C1 CMP 0 to X CMP 0 causes performance drop on 32-bit x86.
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Jan 2016 14:50:07 +0000
- Subject: [Bug tree-optimization/69467] [6 Regression] Pattern X * C1 CMP 0 to X CMP 0 causes performance drop on 32-bit x86.
- Auto-submitted: auto-generated
- References: <bug-69467-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69467
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2016-01-25
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Target Milestone|--- |6.0
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
To restore the state before the move from fold to match.pd we'd need to mark
any such pattern involving compares as the outermost expr (and thus match
on GIMPLE_CONDs) with an explicit && single_use () check. Fix for this one:
Index: gcc/match.pd
===================================================================
--- gcc/match.pd (revision 232792)
+++ gcc/match.pd (working copy)
@@ -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)