Skip to content

Commit 1c6e5b2

Browse files
authored
[LV] Improve code using VPlan::get{ConstantInt,True} (NFC) (#172471)
1 parent b6f210b commit 1c6e5b2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7806,12 +7806,9 @@ VPSingleDefRecipe *VPRecipeBuilder::tryToWidenCall(VPInstruction *VPI,
78067806
// 2) No mask is required for the block, but the only available
78077807
// vector variant at this VF requires a mask, so we synthesize an
78087808
// all-true mask.
7809-
VPValue *Mask = nullptr;
7810-
if (Legal->isMaskRequired(CI))
7811-
Mask = getBlockInMask(Builder.getInsertBlock());
7812-
else
7813-
Mask = Plan.getOrAddLiveIn(
7814-
ConstantInt::getTrue(IntegerType::getInt1Ty(Plan.getContext())));
7809+
VPValue *Mask = Legal->isMaskRequired(CI)
7810+
? getBlockInMask(Builder.getInsertBlock())
7811+
: Plan.getTrue();
78157812

78167813
Ops.insert(Ops.begin() + *MaskPos, Mask);
78177814
}
@@ -8253,9 +8250,8 @@ VPRecipeBuilder::tryToCreatePartialReduction(VPInstruction *Reduction,
82538250

82548251
auto *ReductionI = Reduction->getUnderlyingInstr();
82558252
if (Reduction->getOpcode() == Instruction::Sub) {
8256-
auto *const Zero = ConstantInt::get(ReductionI->getType(), 0);
82578253
SmallVector<VPValue *, 2> Ops;
8258-
Ops.push_back(Plan.getOrAddLiveIn(Zero));
8254+
Ops.push_back(Plan.getConstantInt(ReductionI->getType(), 0));
82598255
Ops.push_back(BinOp);
82608256
BinOp = new VPWidenRecipe(*ReductionI, Ops, VPIRFlags(*ReductionI),
82618257
VPIRMetadata(), ReductionI->getDebugLoc());

0 commit comments

Comments
 (0)