aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2024-06-27 19:52:23 +0200
committerGitHub <noreply@github.com>2024-06-27 19:52:23 +0200
commitf55bcc5dbed9de21864e92cd2e6040bb00e6122c (patch)
tree431bc77e82cce474618faf1ed415125c48f17d4c /llvm/lib/IR/AutoUpgrade.cpp
parentd7cd41e571cb8def7914cce51b49e009f8851634 (diff)
downloadllvm-f55bcc5dbed9de21864e92cd2e6040bb00e6122c.zip
llvm-f55bcc5dbed9de21864e92cd2e6040bb00e6122c.tar.gz
llvm-f55bcc5dbed9de21864e92cd2e6040bb00e6122c.tar.bz2
AMDGPU: Add amdgpu.no.fine.grained.memory when upgrading old atomic intrinsics (#89655)
This should replicate the old intrinsic behavior better when codegen of the raw instruction will require metadata in the future.
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);