From f7e15791f110cbec4a46af81bc8ee0267172a7d3 Mon Sep 17 00:00:00 2001 From: Shilei Tian Date: Fri, 13 Sep 2024 09:25:50 -0400 Subject: [PATCH] [AMDGPU][Attributor] Don't run `AAAddressSpace` for graphics functions --- llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp | 29 ++++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) 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())); + } } } }