Skip to content

Commit 8019e6f

Browse files
Removed dead code, moved EVL to last args in EVL recipes, added debugloc
1 parent 1e69bb1 commit 8019e6f

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
@@ -2621,7 +2621,7 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
26212621
/// using the address to load from, the explicit vector length and an optional
26222622
/// mask.
26232623
struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
2624-
VPWidenLoadEVLRecipe(VPWidenLoadRecipe &L, VPValue &EVL, VPValue *Mask)
2624+
VPWidenLoadEVLRecipe(VPWidenLoadRecipe &L, VPValue *Mask, VPValue &EVL)
26252625
: VPWidenMemoryRecipe(VPDef::VPWidenLoadEVLSC, L.getIngredient(),
26262626
{L.getAddr(), &EVL}, L.isConsecutive(),
26272627
L.isReverse(), L.getDebugLoc()),
@@ -2702,7 +2702,7 @@ struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
27022702
/// using the value to store, the address to store to, the explicit vector
27032703
/// length and an optional mask.
27042704
struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
2705-
VPWidenStoreEVLRecipe(VPWidenStoreRecipe &S, VPValue &EVL, VPValue *Mask)
2705+
VPWidenStoreEVLRecipe(VPWidenStoreRecipe &S, VPValue *Mask, VPValue &EVL)
27062706
: VPWidenMemoryRecipe(VPDef::VPWidenStoreEVLSC, S.getIngredient(),
27072707
{S.getAddr(), S.getStoredValue(), &EVL},
27082708
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
@@ -1225,6 +1225,7 @@ VPWidenEVLRecipe *VPWidenEVLRecipe::create(VPWidenRecipe *W, VPValue &EVL) {
12251225
}
12261226

12271227
void VPWidenEVLRecipe::execute(VPTransformState &State) {
1228+
State.setDebugLocFrom(getDebugLoc());
12281229
assert(State.UF == 1 && "Expected only UF == 1 when vectorizing with "
12291230
"explicit vector length.");
12301231
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)