[PATCH] D56765: [X86] Add a one use check to the setcc inversion code in combineVSelectWithAllOnesOrZeros

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 17:23:31 PST 2019


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.

If we're going to generate a new inverted setcc, we should make sure we will be able to remove the old setcc.

This found in a larger test case from a coworker I haven't had a chance to reduce yet.


https://reviews.llvm.org/D56765

Files:
  lib/Target/X86/X86ISelLowering.cpp


Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -33849,7 +33849,7 @@
 
   // Try to invert the condition if true value is not all 1s and false value is
   // not all 0s.
-  if (!TValIsAllOnes && !FValIsAllZeros &&
+  if (!TValIsAllOnes && !FValIsAllZeros && Cond.hasOneUse() &&
       // Check if the selector will be produced by CMPP*/PCMP*.
       Cond.getOpcode() == ISD::SETCC &&
       // Check if SETCC has already been promoted.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56765.181943.patch
Type: text/x-patch
Size: 579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190116/623d784e/attachment.bin>


More information about the llvm-commits mailing list