[llvm] cff753f - [X86] SimplifyDemandedVectorEltsForTargetNode - simplify X86ISD::VBROADCAST of 0'th element handling. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 03:32:13 PDT 2024


Author: Simon Pilgrim
Date: 2024-09-23T11:31:58+01:00
New Revision: cff753f8768ff3a7afbc27adaf318ebbf419dcfa

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

LOG: [X86] SimplifyDemandedVectorEltsForTargetNode - simplify X86ISD::VBROADCAST of 0'th element handling. NFC.

Avoid duplicate TLO.CombineTo calls.

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 c5dc3ea17f72c3..3b86d6e0a75cad 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -42866,9 +42866,8 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
     // Don't bother broadcasting if we just need the 0'th element.
     if (DemandedElts == 1) {
       if (!SrcVT.isVector())
-        return TLO.CombineTo(
-            Op, TLO.DAG.getNode(ISD::SCALAR_TO_VECTOR, SDLoc(Op), VT, Src));
-      if (Src.getValueType() != VT)
+        Src = TLO.DAG.getNode(ISD::SCALAR_TO_VECTOR, SDLoc(Op), VT, Src);
+      else if (Src.getValueType() != VT)
         Src = widenSubVector(VT.getSimpleVT(), Src, false, Subtarget, TLO.DAG,
                              SDLoc(Op));
       return TLO.CombineTo(Op, Src);


        


More information about the llvm-commits mailing list