[llvm] [AMDGPU] Make ds/global load intrinsics IntrArgMemOnly (PR #152792)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 13:48:39 PDT 2025


https://github.com/choikwa created https://github.com/llvm/llvm-project/pull/152792

This along with IntrReadMem means that the Intrinsic only reads memory through the given argument ptr and its derivatives. This allows passes like Inliner to attach alias.scope to the call instruction as it sees that no other memory is accessed.

Discovered via SWDEV-543741

>From e16ee1e521bff7c45c67abcbeeca1eaa25e2d8f6 Mon Sep 17 00:00:00 2001
From: Kevin Choi <kevin.choi at amd.com>
Date: Fri, 8 Aug 2025 15:26:15 -0500
Subject: [PATCH] [AMDGPU] Make ds/global load intrinsics IntrArgMemOnly

This along with IntrReadMem means that the Intrinsic only reads memory through the given argument ptr and its derivatives.
This allows passes like Inliner to attach alias.scope to the call instruction as it sees that no other memory is accessed.
---
 llvm/include/llvm/IR/IntrinsicsAMDGPU.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/IR/IntrinsicsAMDGPU.td b/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
index 90cfd8cedd51b..be6df257f668b 100644
--- a/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
+++ b/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
@@ -3087,7 +3087,7 @@ class AMDGPULoadIntrinsic<LLVMType ptr_ty>:
   Intrinsic<
     [llvm_any_ty],
     [ptr_ty],
-    [IntrReadMem, IntrWillReturn, IntrConvergent, NoCapture<ArgIndex<0>>, IntrNoCallback, IntrNoFree],
+    [IntrReadMem, IntrArgMemOnly, IntrWillReturn, IntrConvergent, NoCapture<ArgIndex<0>>, IntrNoCallback, IntrNoFree],
     "",
     [SDNPMemOperand]
   >;



More information about the llvm-commits mailing list