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