[llvm] 65a9254 - [X86] canonicalizeShuffleWithOp - pull out repeated flag settings to IsMergeableWithShuffle lambda. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 03:32:12 PST 2025


Author: Simon Pilgrim
Date: 2025-02-10T11:31:58Z
New Revision: 65a92544f7716541cdfab99499ce467b26a3ce8e

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

LOG: [X86] canonicalizeShuffleWithOp - pull out repeated flag settings to IsMergeableWithShuffle lambda. NFC.

Prep work before tweaking the flags in a future patch.

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 4e7ee83d004887..34ac4262beb85d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -41598,10 +41598,10 @@ static SDValue canonicalizeShuffleWithOp(SDValue N, SelectionDAG &DAG,
       if (TLI.isBinOp(SrcOpcode) && IsSafeToMoveShuffle(N0, SrcOpcode)) {
         SDValue Op00 = peekThroughOneUseBitcasts(N0.getOperand(0));
         SDValue Op01 = peekThroughOneUseBitcasts(N0.getOperand(1));
-        if (IsMergeableWithShuffle(Op00, Opc != X86ISD::VPERMI,
-                                   Opc != X86ISD::PSHUFB) ||
-            IsMergeableWithShuffle(Op01, Opc != X86ISD::VPERMI,
-                                   Opc != X86ISD::PSHUFB)) {
+        bool FoldShuf = Opc != X86ISD::VPERMI;
+        bool FoldLoad = Opc != X86ISD::PSHUFB;
+        if (IsMergeableWithShuffle(Op00, FoldShuf, FoldLoad) ||
+            IsMergeableWithShuffle(Op01, FoldShuf, FoldLoad)) {
           SDValue LHS, RHS;
           Op00 = DAG.getBitcast(ShuffleVT, Op00);
           Op01 = DAG.getBitcast(ShuffleVT, Op01);


        


More information about the llvm-commits mailing list