[llvm] fa620fc - [X86] combineConcatVectorOps - reuse IsSplat and remove duplicate code. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 05:39:34 PST 2020


Author: Simon Pilgrim
Date: 2020-02-11T13:37:57Z
New Revision: fa620fc8e28ef1895a009994d6e838e3ddbcb32a

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

LOG: [X86] combineConcatVectorOps - reuse IsSplat and remove duplicate code. NFC.

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 b0187eb72920..f5a101196d09 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -45931,6 +45931,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
     return getZeroVector(VT, Subtarget, DAG, DL);
 
   SDValue Op0 = Ops[0];
+  bool IsSplat = llvm::all_of(Ops, [&Op0](SDValue Op) { return Op == Op0; });
 
   // Fold subvector loads into one.
   // If needed, look through bitcasts to get to the load.
@@ -45947,7 +45948,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
   }
 
   // Repeated subvectors.
-  if (llvm::all_of(Ops, [Op0](SDValue Op) { return Op == Op0; })) {
+  if (IsSplat) {
     // If this broadcast/subv_broadcast is inserted into both halves, use a
     // larger broadcast/subv_broadcast.
     if (Op0.getOpcode() == X86ISD::VBROADCAST ||
@@ -45970,8 +45971,6 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
       return DAG.getNode(X86ISD::VBROADCAST, DL, VT, Op0.getOperand(0));
   }
 
-  bool IsSplat = llvm::all_of(Ops, [&Op0](SDValue Op) { return Op == Op0; });
-
   // Repeated opcode.
   // TODO - combineX86ShufflesRecursively should handle shuffle concatenation
   // but it currently struggles with 
diff erent vector widths.


        


More information about the llvm-commits mailing list