diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp index 687a7339da379..37c8b043aca19 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp @@ -1077,19 +1077,22 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM, addPreloadKernArgHint(*F, TM); } - for (auto &I : instructions(F)) { - if (auto *LI = dyn_cast(&I)) { - A.getOrCreateAAFor( - IRPosition::value(*LI->getPointerOperand())); - } else if (auto *SI = dyn_cast(&I)) { - A.getOrCreateAAFor( - IRPosition::value(*SI->getPointerOperand())); - } else if (auto *RMW = dyn_cast(&I)) { - A.getOrCreateAAFor( - IRPosition::value(*RMW->getPointerOperand())); - } else if (auto *CmpX = dyn_cast(&I)) { - A.getOrCreateAAFor( - IRPosition::value(*CmpX->getPointerOperand())); + // Don't bother to run AAAddressSpace for graphics. + if (!AMDGPU::isGraphics(F->getCallingConv())) { + for (auto &I : instructions(F)) { + if (auto *LI = dyn_cast(&I)) { + A.getOrCreateAAFor( + IRPosition::value(*LI->getPointerOperand())); + } else if (auto *SI = dyn_cast(&I)) { + A.getOrCreateAAFor( + IRPosition::value(*SI->getPointerOperand())); + } else if (auto *RMW = dyn_cast(&I)) { + A.getOrCreateAAFor( + IRPosition::value(*RMW->getPointerOperand())); + } else if (auto *CmpX = dyn_cast(&I)) { + A.getOrCreateAAFor( + IRPosition::value(*CmpX->getPointerOperand())); + } } } }