[llvm] 5892a2b - [VPlan] Remove dead code from GetBroadCastInstr (NFCI).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 17 13:51:33 PDT 2025


Author: Florian Hahn
Date: 2025-08-17T21:51:14+01:00
New Revision: 5892a2beec4eaf77922211a9aec70faa0ae287db

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

LOG: [VPlan] Remove dead code from GetBroadCastInstr (NFCI).

All relevant places should already explicitly materialize broadcasts.
Remove dead code from VPTransformState::get

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 3682bd0e17200..724a38e565304 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -295,27 +295,11 @@ Value *VPTransformState::get(const VPValue *Def, bool NeedsScalar) {
   if (hasVectorValue(Def))
     return Data.VPV2Vector[Def];
 
-  auto GetBroadcastInstrs = [this, Def](Value *V) {
-    bool SafeToHoist =
-        !Def->hasDefiningRecipe() ||
-        VPDT.properlyDominates(Def->getDefiningRecipe()->getParent(),
-                               Plan->getVectorPreheader());
-
+  auto GetBroadcastInstrs = [this](Value *V) {
     if (VF.isScalar())
       return V;
-    // Place the code for broadcasting invariant variables in the new preheader.
-    IRBuilder<>::InsertPointGuard Guard(Builder);
-    if (SafeToHoist) {
-      BasicBlock *LoopVectorPreHeader =
-          CFG.VPBB2IRBB[Plan->getVectorPreheader()];
-      if (LoopVectorPreHeader)
-        Builder.SetInsertPoint(LoopVectorPreHeader->getTerminator());
-    }
-
-    // Place the code for broadcasting invariant variables in the new preheader.
     // Broadcast the scalar into all locations in the vector.
     Value *Shuf = Builder.CreateVectorSplat(VF, V, "broadcast");
-
     return Shuf;
   };
 


        


More information about the llvm-commits mailing list