[llvm] [InferAddressSpaces] Infer pointer stored and then loaded from global variable (PR #159755)

Wenju He via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 22 04:13:38 PDT 2025


================
@@ -262,16 +262,15 @@ define dso_local ptx_kernel void @escape_ptr_gep_store(ptr nocapture noundef wri
 ; PTX-EMPTY:
 ; PTX-NEXT:  // %bb.0: // %entry
 ; PTX-NEXT:    mov.b64 %SPL, __local_depot5;
-; PTX-NEXT:    cvta.local.u64 %SP, %SPL;
 ; PTX-NEXT:    ld.param.b64 %rd1, [escape_ptr_gep_store_param_0];
 ; PTX-NEXT:    cvta.to.global.u64 %rd2, %rd1;
-; PTX-NEXT:    add.u64 %rd3, %SP, 0;
-; PTX-NEXT:    add.u64 %rd4, %SPL, 0;
----------------
wenju-he wrote:

A redundant add was eliminated. This test has no GV load/store. The change is because of updated collectFlatAddressExpressions:
```
    else if (auto *SI = dyn_cast<StoreInst>(&I)) {
      Value *V = SI->getValueOperand();
      if (V->getType()->isPtrOrPtrVectorTy())
        PushPtrOperand(V);
```

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


More information about the llvm-commits mailing list