[llvm] b18835f - [X86] lowerShuffleOfExtractsAsVperm - move hasOneUse checks to the end of the match. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 2 11:16:38 PDT 2023


Author: Simon Pilgrim
Date: 2023-04-02T19:00:53+01:00
New Revision: b18835f1c223baac797a255dd360b7e8515843e6

URL: https://github.com/llvm/llvm-project/commit/b18835f1c223baac797a255dd360b7e8515843e6
DIFF: https://github.com/llvm/llvm-project/commit/b18835f1c223baac797a255dd360b7e8515843e6.diff

LOG: [X86] lowerShuffleOfExtractsAsVperm - move hasOneUse checks to the end of the match. NFCI.

Check the cheap parts of the pattern first, and make the more expensive hasOneUse() call as late as possible.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 2b8815a607b1..fc6ab0630cb3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -14815,10 +14815,10 @@ static SDValue lowerShuffleOfExtractsAsVperm(const SDLoc &DL, SDValue N0,
          "VPERM* family of shuffles requires 32-bit or 64-bit elements");
 
   // Check that both sources are extracts of the same source vector.
-  if (!N0.hasOneUse() || !N1.hasOneUse() ||
-      N0.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
+  if (N0.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
       N1.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
-      N0.getOperand(0) != N1.getOperand(0))
+      N0.getOperand(0) != N1.getOperand(0) ||
+      !N0.hasOneUse() || !N1.hasOneUse())
     return SDValue();
 
   SDValue WideVec = N0.getOperand(0);


        


More information about the llvm-commits mailing list