diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp index 4669bb45473c..cfce56f0bfe9 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp @@ -336,8 +336,8 @@ static void markUsedByKernel(Function *Func, GlobalVariable *SGV) { BasicBlock *Entry = &Func->getEntryBlock(); IRBuilder<> Builder(Entry, Entry->getFirstNonPHIIt()); - Function *Decl = - Intrinsic::getDeclaration(Func->getParent(), Intrinsic::donothing, {}); + Function *Decl = Intrinsic::getOrInsertDeclaration(Func->getParent(), + Intrinsic::donothing, {}); Value *UseInstance[1] = { Builder.CreateConstInBoundsGEP1_32(SGV->getValueType(), SGV, 0)}; @@ -922,7 +922,8 @@ void AMDGPUSwLowerLDS::lowerKernelLDSAccesses(Function *Func, StringRef("__asan_free_impl"), FunctionType::get(IRB.getVoidTy(), {Int64Ty, Int64Ty}, false)); Value *ReturnAddr = IRB.CreateCall( - Intrinsic::getDeclaration(&M, Intrinsic::returnaddress), IRB.getInt32(0)); + Intrinsic::getOrInsertDeclaration(&M, Intrinsic::returnaddress), + IRB.getInt32(0)); Value *RAPToInt = IRB.CreatePtrToInt(ReturnAddr, Int64Ty); Value *MallocPtrToInt = IRB.CreatePtrToInt(LoadMallocPtr, Int64Ty); IRB.CreateCall(AsanFreeFunc, {MallocPtrToInt, RAPToInt}); @@ -1055,8 +1056,8 @@ void AMDGPUSwLowerLDS::lowerNonKernelLDSAccesses( SetVector<Instruction *> LDSInstructions; getLDSMemoryInstructions(Func, LDSInstructions); - Function *Decl = - Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_lds_kernel_id, {}); + Function *Decl = Intrinsic::getOrInsertDeclaration( + &M, Intrinsic::amdgcn_lds_kernel_id, {}); auto *KernelId = IRB.CreateCall(Decl, {}); GlobalVariable *LDSBaseTable = NKLDSParams.LDSBaseTable; GlobalVariable *LDSOffsetTable = NKLDSParams.LDSOffsetTable; |
