aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 32076a0..5beefaa 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -2359,7 +2359,8 @@ static Value *upgradeAMDGCNIntrinsicCall(StringRef Name, CallBase *CI,
return nullptr;
Value *Ptr = CI->getArgOperand(0);
- if (!isa<PointerType>(Ptr->getType())) // Malformed.
+ PointerType *PtrTy = dyn_cast<PointerType>(Ptr->getType());
+ if (!PtrTy) // Malformed.
return nullptr;
Value *Val = CI->getArgOperand(1);
@@ -2405,6 +2406,11 @@ static Value *upgradeAMDGCNIntrinsicCall(StringRef Name, CallBase *CI,
AtomicRMWInst *RMW =
Builder.CreateAtomicRMW(RMWOp, Ptr, Val, std::nullopt, Order, SSID);
+ if (PtrTy->getAddressSpace() != 3) {
+ RMW->setMetadata("amdgpu.no.fine.grained.memory",
+ MDNode::get(F->getContext(), {}));
+ }
+
if (IsVolatile)
RMW->setVolatile(true);