* [PATCH] Fix PR67438
@ 2015-12-04 8:08 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-12-04 8:08 UTC (permalink / raw)
To: gcc-patches
The following is the only way I currently see to fix PR67438, register
pressure increase over a conditional due to a match pattern applying
to ops with multiple uses.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2015-12-04 Richard Biener <rguenther@suse.de>
PR middle-end/67438
* match.pd: Guard ~X cmp ~Y -> Y cmp X and the variant with
a constant with single_use.
Index: gcc/match.pd
===================================================================
--- gcc/match.pd (revision 231221)
+++ gcc/match.pd (working copy)
@@ -1855,15 +1879,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Fold ~X op ~Y as Y op X. */
(for cmp (simple_comparison)
(simplify
- (cmp (bit_not @0) (bit_not @1))
- (cmp @1 @0)))
+ (cmp (bit_not@2 @0) (bit_not@3 @1))
+ (if (single_use (@2) && single_use (@3))
+ (cmp @1 @0))))
/* Fold ~X op C as X op' ~C, where op' is the swapped comparison. */
(for cmp (simple_comparison)
scmp (swapped_simple_comparison)
(simplify
- (cmp (bit_not @0) CONSTANT_CLASS_P@1)
- (if (TREE_CODE (@1) == INTEGER_CST || TREE_CODE (@1) == VECTOR_CST)
+ (cmp (bit_not@2 @0) CONSTANT_CLASS_P@1)
+ (if (single_use (@2)
+ && (TREE_CODE (@1) == INTEGER_CST || TREE_CODE (@1) == VECTOR_CST))
(scmp @0 (bit_not @1)))))
(for cmp (simple_comparison)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-04 8:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04 8:08 [PATCH] Fix PR67438 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).