[llvm] b4f91b0 - [LV] Use IRBuilder::insert to insert VPWidenRecipe (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 16 12:25:16 PST 2025


Author: Florian Hahn
Date: 2025-02-16T21:25:07+01:00
New Revision: b4f91b007fa4df0923b92c88103dab37c576150b

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

LOG: [LV] Use IRBuilder::insert to insert VPWidenRecipe (NFC).

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 2cdb87fdd3f8d..4685064407f08 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8937,15 +8937,12 @@ VPRecipeBuilder::tryToCreatePartialReduction(Instruction *Reduction,
 
   unsigned ReductionOpcode = Reduction->getOpcode();
   if (ReductionOpcode == Instruction::Sub) {
-    VPBasicBlock *ParentBlock = Builder.getInsertBlock();
-    assert(ParentBlock && "Builder must have an insert block.");
-
     auto *const Zero = ConstantInt::get(Reduction->getType(), 0);
     SmallVector<VPValue *, 2> Ops;
     Ops.push_back(Plan.getOrAddLiveIn(Zero));
     Ops.push_back(BinOp);
     BinOp = new VPWidenRecipe(*Reduction, make_range(Ops.begin(), Ops.end()));
-    ParentBlock->appendRecipe(BinOp->getDefiningRecipe());
+    Builder.insert(BinOp->getDefiningRecipe());
     ReductionOpcode = Instruction::Add;
   }
 


        


More information about the llvm-commits mailing list