[llvm] [AMDGPU] Fix spurious NoAlias results (PR #122309)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 02:45:15 PST 2025
================
@@ -80,10 +80,13 @@ AliasResult AMDGPUAAResult::alias(const MemoryLocation &LocA,
} else if (const Argument *Arg = dyn_cast<Argument>(ObjA)) {
const Function *F = Arg->getParent();
switch (F->getCallingConv()) {
- case CallingConv::AMDGPU_KERNEL:
+ case CallingConv::AMDGPU_KERNEL: {
// In the kernel function, kernel arguments won't alias to (local)
// variables in shared or private address space.
- return AliasResult::NoAlias;
+ const auto *ObjB =
+ getUnderlyingObject(B.Ptr->stripPointerCastsForAliasAnalysis());
+ return (ObjA == ObjB) ? AliasResult::MustAlias : AliasResult::NoAlias;
----------------
nikic wrote:
In this patch we know that ObjA is an Argument, so that shouldn't be possible.
https://github.com/llvm/llvm-project/pull/122309
More information about the llvm-commits
mailing list