Skip to content

Commit 80c43db

Browse files
Removed dead code, moved EVL to last args in EVL recipes, added debugloc
1 parent ea01c5d commit 80c43db

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,7 +2605,7 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
26052605
/// using the address to load from, the explicit vector length and an optional
26062606
/// mask.
26072607
struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
2608-
VPWidenLoadEVLRecipe(VPWidenLoadRecipe &L, VPValue &EVL, VPValue *Mask)
2608+
VPWidenLoadEVLRecipe(VPWidenLoadRecipe &L, VPValue *Mask, VPValue &EVL)
26092609
: VPWidenMemoryRecipe(VPDef::VPWidenLoadEVLSC, L.getIngredient(),
26102610
{L.getAddr(), &EVL}, L.isConsecutive(),
26112611
L.isReverse(), L.getDebugLoc()),
@@ -2686,7 +2686,7 @@ struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
26862686
/// using the value to store, the address to store to, the explicit vector
26872687
/// length and an optional mask.
26882688
struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
2689-
VPWidenStoreEVLRecipe(VPWidenStoreRecipe &S, VPValue &EVL, VPValue *Mask)
2689+
VPWidenStoreEVLRecipe(VPWidenStoreRecipe &S, VPValue *Mask, VPValue &EVL)
26902690
: VPWidenMemoryRecipe(VPDef::VPWidenStoreEVLSC, S.getIngredient(),
26912691
{S.getAddr(), S.getStoredValue(), &EVL},
26922692
S.isConsecutive(), S.isReverse(), S.getDebugLoc()) {

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ void VPWidenRecipe::execute(VPTransformState &State) {
11451145
}
11461146

11471147
void VPWidenEVLRecipe::execute(VPTransformState &State) {
1148+
State.setDebugLocFrom(getDebugLoc());
11481149
assert(State.UF == 1 && "Expected only UF == 1 when vectorizing with "
11491150
"explicit vector length.");
11501151
VPValue *Op0 = getOperand(0);

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,10 +1409,6 @@ void VPlanTransforms::addActiveLaneMask(
14091409

14101410
/// Replace recipes with their EVL variants.
14111411
static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
1412-
VPDominatorTree VPDT;
1413-
VPDT.recalculate(Plan);
1414-
SmallVector<VPRecipeBase *> ToRemove;
1415-
14161412
SmallVector<VPValue *> HeaderMasks = collectAllHeaderMasks(Plan);
14171413
for (VPValue *HeaderMask : collectAllHeaderMasks(Plan)) {
14181414
for (VPUser *U : collectUsersRecursively(HeaderMask)) {
@@ -1428,11 +1424,11 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
14281424
TypeSwitch<VPRecipeBase *, VPRecipeBase *>(CurRecipe)
14291425
.Case<VPWidenLoadRecipe>([&](VPWidenLoadRecipe *L) {
14301426
VPValue *NewMask = GetNewMask(L->getMask());
1431-
return new VPWidenLoadEVLRecipe(L, &EVL, NewMask);
1427+
return new VPWidenLoadEVLRecipe(*L, NewMask, EVL);
14321428
})
14331429
.Case<VPWidenStoreRecipe>([&](VPWidenStoreRecipe *S) {
14341430
VPValue *NewMask = GetNewMask(S->getMask());
1435-
return new VPWidenStoreEVLRecipe(S, &EVL, NewMask);
1431+
return new VPWidenStoreEVLRecipe(*S, NewMask, EVL);
14361432
})
14371433
.Case<VPWidenRecipe>([&](VPWidenRecipe *W) -> VPRecipeBase * {
14381434
unsigned Opcode = W->getOpcode();

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
11401140
VPReductionRecipe Recipe(RecurrenceDescriptor(), nullptr, &ChainOp, &CondOp,
11411141
&VecOp, false);
11421142
VPValue EVL;
1143-
VPReductionEVLRecipe EVLRecipe(Recipe, EVL, &CondOp);
1143+
VPReductionEVLRecipe EVLRecipe(Recipe, &CondOp, EVL);
11441144
EXPECT_FALSE(EVLRecipe.mayHaveSideEffects());
11451145
EXPECT_FALSE(EVLRecipe.mayReadFromMemory());
11461146
EXPECT_FALSE(EVLRecipe.mayWriteToMemory());
@@ -1495,7 +1495,7 @@ TEST(VPRecipeTest, CastVPReductionEVLRecipeToVPUser) {
14951495
VPReductionRecipe Recipe(RecurrenceDescriptor(), nullptr, &ChainOp, &CondOp,
14961496
&VecOp, false);
14971497
VPValue EVL;
1498-
VPReductionEVLRecipe EVLRecipe(Recipe, EVL, &CondOp);
1498+
VPReductionEVLRecipe EVLRecipe(Recipe, &CondOp, EVL);
14991499
EXPECT_TRUE(isa<VPUser>(&EVLRecipe));
15001500
VPRecipeBase *BaseR = &EVLRecipe;
15011501
EXPECT_TRUE(isa<VPUser>(BaseR));

0 commit comments

Comments
 (0)