@@ -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
0 commit comments