Skip to content

Commit 4c911e3

Browse files
committed
[VPlan] Refine the constructor of VPWidenIntrinsicRecipe
1 parent a4fd3db commit 4c911e3

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
@@ -1688,13 +1688,18 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags {
16881688

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

16991704
~VPWidenIntrinsicRecipe() override = default;
17001705

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

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

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

0 commit comments

Comments
 (0)