@@ -1687,13 +1687,18 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags {
1687
1687
1688
1688
VPWidenIntrinsicRecipe (Intrinsic::ID VectorIntrinsicID,
1689
1689
ArrayRef<VPValue *> CallArguments, Type *Ty,
1690
- bool MayReadFromMemory, bool MayWriteToMemory,
1691
- bool MayHaveSideEffects, DebugLoc DL = {})
1690
+ DebugLoc DL = {})
1692
1691
: 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
+ }
1697
1702
1698
1703
~VPWidenIntrinsicRecipe () override = default ;
1699
1704
0 commit comments