Skip to content

Commit 7cbcdf8

Browse files
committed
[VPlan] Refine the constructor of VPWidenIntrinsicRecipe
1 parent 8d7c8d8 commit 7cbcdf8

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,13 +1687,18 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags {
16871687

16881688
VPWidenIntrinsicRecipe(Intrinsic::ID VectorIntrinsicID,
16891689
ArrayRef<VPValue *> CallArguments, Type *Ty,
1690-
bool MayReadFromMemory, bool MayWriteToMemory,
1691-
bool MayHaveSideEffects, DebugLoc DL = {})
1690+
DebugLoc DL = {})
16921691
: VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, DL),
1693-
VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
1694-
MayReadFromMemory(MayReadFromMemory),
1695-
MayWriteToMemory(MayWriteToMemory),
1696-
MayHaveSideEffects(MayHaveSideEffects) {}
1692+
VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
1693+
LLVMContext &Ctx = Ty->getContext();
1694+
AttributeList Attrs = Intrinsic::getAttributes(Ctx, VectorIntrinsicID);
1695+
MemoryEffects ME = Attrs.getMemoryEffects();
1696+
MayReadFromMemory = ME.onlyWritesMemory();
1697+
MayWriteToMemory = ME.onlyReadsMemory();
1698+
MayHaveSideEffects = MayWriteToMemory ||
1699+
Attrs.hasFnAttr(Attribute::NoUnwind) ||
1700+
!Attrs.hasFnAttr(Attribute::WillReturn);
1701+
}
16971702

16981703
~VPWidenIntrinsicRecipe() override = default;
16991704

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
14881488
Ops.push_back(&EVL);
14891489
return new VPWidenIntrinsicRecipe(Intrinsic::vp_select, Ops,
14901490
TypeInfo.inferScalarType(Sel),
1491-
false, false, false);
1491+
Sel->getDebugLoc());
14921492
})
14931493

14941494
.Default([&](VPRecipeBase *R) { return nullptr; });

0 commit comments

Comments
 (0)