@@ -1748,11 +1748,10 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
1748
1748
if (unsigned VFSize =
1749
1749
TypeInfo.inferScalarType (MaxEVL)->getScalarSizeInBits ();
1750
1750
VFSize != 32 ) {
1751
- MaxEVL = new VPScalarCastRecipe (
1751
+ VPBuilder Builder (LoopRegion->getPreheaderVPBB ());
1752
+ MaxEVL = Builder.createScalarCast (
1752
1753
VFSize > 32 ? Instruction::Trunc : Instruction::ZExt, MaxEVL,
1753
1754
Type::getInt32Ty (Ctx), DebugLoc ());
1754
- VPBasicBlock *Preheader = LoopRegion->getPreheaderVPBB ();
1755
- Preheader->appendRecipe (cast<VPScalarCastRecipe>(MaxEVL));
1756
1755
}
1757
1756
PrevEVL = new VPScalarPHIRecipe (MaxEVL, &EVL, DebugLoc (), " prev.evl" );
1758
1757
PrevEVL->insertBefore (*Header, Header->getFirstNonPhi ());
@@ -1872,20 +1871,19 @@ bool VPlanTransforms::tryAddExplicitVectorLength(
1872
1871
1873
1872
auto *CanonicalIVIncrement =
1874
1873
cast<VPInstruction>(CanonicalIVPHI->getBackedgeValue ());
1874
+ Builder.setInsertPoint (CanonicalIVIncrement);
1875
1875
VPSingleDefRecipe *OpVPEVL = VPEVL;
1876
1876
if (unsigned IVSize = CanonicalIVPHI->getScalarType ()->getScalarSizeInBits ();
1877
1877
IVSize != 32 ) {
1878
- OpVPEVL = new VPScalarCastRecipe (
1878
+ OpVPEVL = Builder. createScalarCast (
1879
1879
IVSize < 32 ? Instruction::Trunc : Instruction::ZExt, OpVPEVL,
1880
1880
CanonicalIVPHI->getScalarType (), CanonicalIVIncrement->getDebugLoc ());
1881
- OpVPEVL->insertBefore (CanonicalIVIncrement);
1882
1881
}
1883
- auto *NextEVLIV =
1884
- new VPInstruction (Instruction::Add, {OpVPEVL, EVLPhi},
1885
- {CanonicalIVIncrement->hasNoUnsignedWrap (),
1886
- CanonicalIVIncrement->hasNoSignedWrap ()},
1887
- CanonicalIVIncrement->getDebugLoc (), " index.evl.next" );
1888
- NextEVLIV->insertBefore (CanonicalIVIncrement);
1882
+ auto *NextEVLIV = Builder.createOverflowingOp (
1883
+ Instruction::Add, {OpVPEVL, EVLPhi},
1884
+ {CanonicalIVIncrement->hasNoUnsignedWrap (),
1885
+ CanonicalIVIncrement->hasNoSignedWrap ()},
1886
+ CanonicalIVIncrement->getDebugLoc (), " index.evl.next" );
1889
1887
EVLPhi->addOperand (NextEVLIV);
1890
1888
1891
1889
transformRecipestoEVLRecipes (Plan, *VPEVL);
0 commit comments