[llvm] [AMDGPU] Fix value swap for potentially aliased out arguments in RewriteOutArguments (PR #202922)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 03:49:54 PDT 2026


================
@@ -258,6 +260,11 @@ bool AMDGPURewriteOutArguments::runOnFunction(Function &F) {
         if (Q.isDef())
           SI = dyn_cast<StoreInst>(Q.getInst());
 
+        // MDA stops at the first may-aliasing store, which need not be to this
+        // argument; only fold a store whose pointer is exactly OutArg.
+        if (SI && SI->getPointerOperand()->stripPointerCasts() != OutArg)
----------------
arsenm wrote:

I wouldn't expect to need fixups on alias analysis results? But stripPointerCasts is probably unnecessary with opaque pointers? 

https://github.com/llvm/llvm-project/pull/202922


More information about the llvm-commits mailing list