File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,8 @@ class IRBuilderBase {
380380 void setConstrainedFPCallAttr (CallBase *I) {
381381 I->addFnAttr (Attribute::StrictFP);
382382 MemoryEffects ME = MemoryEffects::inaccessibleMemOnly ();
383+ if (I->getAttributes ().hasFnAttr (Attribute::Memory))
384+ ME |= I->getAttributes ().getMemoryEffects ();
383385 auto A = Attribute::getWithMemoryEffects (getContext (), ME);
384386 I->addFnAttr (A);
385387 }
Original file line number Diff line number Diff line change @@ -1158,6 +1158,8 @@ class CallBase : public Instruction {
11581158 // / number of extra operands.
11591159 unsigned getNumSubclassExtraOperandsDynamic () const ;
11601160
1161+ MemoryEffects getMemoryEffectsForBundles () const ;
1162+
11611163public:
11621164 using Instruction::getContext;
11631165
Original file line number Diff line number Diff line change @@ -644,17 +644,23 @@ bool CallBase::hasFloatingPointBundles() const {
644644 getOperandBundle (LLVMContext::OB_fpe_except);
645645}
646646
647+ MemoryEffects CallBase::getMemoryEffectsForBundles () const {
648+ MemoryEffects ME = MemoryEffects::none ();
649+ if (hasFloatingPointBundles ())
650+ ME |= MemoryEffects::inaccessibleMemOnly ();
651+ if (hasReadingOperandBundles ())
652+ ME |= MemoryEffects::readOnly ();
653+ if (hasClobberingOperandBundles ())
654+ ME |= MemoryEffects::writeOnly ();
655+ return ME;
656+ }
657+
647658MemoryEffects CallBase::getMemoryEffects () const {
648659 MemoryEffects ME = getAttributes ().getMemoryEffects ();
649660 if (auto *Fn = dyn_cast<Function>(getCalledOperand ())) {
650661 MemoryEffects FnME = Fn->getMemoryEffects ();
651- if (hasOperandBundles ()) {
652- // TODO: Add a method to get memory effects for operand bundles instead.
653- if (hasReadingOperandBundles ())
654- FnME |= MemoryEffects::readOnly ();
655- if (hasClobberingOperandBundles ())
656- FnME |= MemoryEffects::writeOnly ();
657- }
662+ if (hasOperandBundles ())
663+ FnME |= getMemoryEffectsForBundles ();
658664 ME &= FnME;
659665 }
660666 return ME;
You can’t perform that action at this time.
0 commit comments