[llvm] [VPlan] Refine the constructor of VPWidenIntrinsicRecipe. nfc (PR #113890)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 12:18:54 PDT 2024
================
@@ -1688,13 +1688,18 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags {
VPWidenIntrinsicRecipe(Intrinsic::ID VectorIntrinsicID,
ArrayRef<VPValue *> CallArguments, Type *Ty,
- bool MayReadFromMemory, bool MayWriteToMemory,
- bool MayHaveSideEffects, DebugLoc DL = {})
+ DebugLoc DL = {})
: VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments),
- VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
- MayReadFromMemory(MayReadFromMemory),
- MayWriteToMemory(MayWriteToMemory),
- MayHaveSideEffects(MayHaveSideEffects) {}
+ VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
+ LLVMContext &Ctx = Ty->getContext();
+ AttributeList Attrs = Intrinsic::getAttributes(Ctx, VectorIntrinsicID);
+ MemoryEffects ME = Attrs.getMemoryEffects();
+ MayReadFromMemory = ME.onlyWritesMemory();
+ MayWriteToMemory = ME.onlyReadsMemory();
+ MayHaveSideEffects = MayWriteToMemory ||
+ Attrs.hasFnAttr(Attribute::NoUnwind) ||
----------------
fhahn wrote:
It should be considered as having side-effects, if it may throw/undwind, e.g. doesn't have `NoUnwind`?
```suggestion
!Attrs.hasFnAttr(Attribute::NoUnwind) ||
```
https://github.com/llvm/llvm-project/pull/113890
More information about the llvm-commits
mailing list