[llvm] 4701afa - [X86] combineX86ShufflesRecursively - merge loops peeking through shuffle operands. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 09:52:09 PDT 2025


Author: Simon Pilgrim
Date: 2025-04-07T17:51:56+01:00
New Revision: 4701afaeaf2aba604a6160cde04634be88e21022

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

LOG: [X86] combineX86ShufflesRecursively - merge loops peeking through shuffle operands. NFC.

Merge loops to peek through free insert_subvector / bitcasts / extract_subvector.

To keep this NFC I haven't reordered the peek throughs - this will done in a future patch to help with #133947 regressions

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 56b0f721383f1..bac5684733e60 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -41115,9 +41115,9 @@ static SDValue combineX86ShufflesRecursively(
     }
   }
 
-  // Peek through vector widenings and set out of bounds mask indices to undef.
-  // TODO: Can resolveTargetShuffleInputsAndMask do some of this?
   for (auto [I, Op] : enumerate(Ops)) {
+    // Peek through vector widenings + set out of bounds mask indices to undef.
+    // TODO: Can resolveTargetShuffleInputsAndMask do some of this?
     if (Op.getOpcode() == ISD::INSERT_SUBVECTOR && Op.getOperand(0).isUndef() &&
         isNullConstant(Op.getOperand(2))) {
       Op = Op.getOperand(1);
@@ -41130,10 +41130,8 @@ static SDValue combineX86ShufflesRecursively(
           M = SM_SentinelUndef;
       }
     }
-  }
 
-  // Peek through any free bitcasts/extract_subvector nodes back to root size.
-  for (SDValue &Op : Ops){
+    // Peek through any free bitcasts/extract_subvector nodes back to root size.
     SDValue BC = Op;
     if (BC.getOpcode() == ISD::BITCAST && BC.hasOneUse())
       BC = peekThroughOneUseBitcasts(BC);


        


More information about the llvm-commits mailing list