[llvm] [InferAddressSpaces] Infer pointer stored and then loaded from global variable (PR #159755)
Wenju He via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 24 03:42:25 PST 2025
================
@@ -335,13 +349,25 @@ static bool isAddressExpression(const Value &V, const DataLayout &DL,
}
case Instruction::IntToPtr:
return isNoopPtrIntCastPair(Op, DL, TTI);
+ case Instruction::Load: {
+ const auto *LI = cast<LoadInst>(Op);
+ if (LI->getType()->isPtrOrPtrVectorTy()) {
+ // Heuristic: treat load-of-GV as an address expression only if the GV is
+ // locally accessed by load and store.
+ if (const auto *GV = dyn_cast<GlobalVariable>(LI->getPointerOperand()))
+ return isLocallyAccessedBySimpleLoadsStores(GV, LI->getFunction());
----------------
wenju-he wrote:
isLocallyAccessedBySimpleLoadsStores is deleted
https://github.com/llvm/llvm-project/pull/159755
More information about the llvm-commits
mailing list