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