diff options
| author | Rahul Joshi <rjoshi@nvidia.com> | 2024-10-11 05:26:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-11 05:26:03 -0700 |
| commit | fa789dffb1e12c2aece0187aeacc48dfb1768340 (patch) | |
| tree | cebfdc0d8b0111115cbefeb8d2927fe8c2cfbdfb /llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp | |
| parent | 900ea21ffb38ba5b783b20f394c43c6c89d58086 (diff) | |
[NFC] Rename `Intrinsic::getDeclaration` to `getOrInsertDeclaration` (#111752)
Rename the function to reflect its correct behavior and to be consistent
with `Module::getOrInsertFunction`. This is also in preparation of
adding a new `Intrinsic::getDeclaration` that will have behavior similar
to `Module::getFunction` (i.e, just lookup, no creation).
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp index e01c9dc66a3f..eb553ae4eb80 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp @@ -753,7 +753,7 @@ bool AMDGPULibCalls::fold(CallInst *CI) { CI->setArgOperand(1, SplatArg1); } - CI->setCalledFunction(Intrinsic::getDeclaration( + CI->setCalledFunction(Intrinsic::getOrInsertDeclaration( CI->getModule(), Intrinsic::ldexp, {CI->getType(), CI->getArgOperand(1)->getType()})); return true; @@ -1034,7 +1034,8 @@ bool AMDGPULibCalls::fold_pow(FPMathOperator *FPOp, IRBuilder<> &B, // pown/pow ---> powr(fabs(x), y) | (x & ((int)y << 31)) FunctionCallee ExpExpr; if (ShouldUseIntrinsic) - ExpExpr = Intrinsic::getDeclaration(M, Intrinsic::exp2, {FPOp->getType()}); + ExpExpr = Intrinsic::getOrInsertDeclaration(M, Intrinsic::exp2, + {FPOp->getType()}); else { ExpExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_EXP2, FInfo)); if (!ExpExpr) @@ -1108,8 +1109,8 @@ bool AMDGPULibCalls::fold_pow(FPMathOperator *FPOp, IRBuilder<> &B, if (needlog) { FunctionCallee LogExpr; if (ShouldUseIntrinsic) { - LogExpr = - Intrinsic::getDeclaration(M, Intrinsic::log2, {FPOp->getType()}); + LogExpr = Intrinsic::getOrInsertDeclaration(M, Intrinsic::log2, + {FPOp->getType()}); } else { LogExpr = getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_LOG2, FInfo)); if (!LogExpr) @@ -1298,8 +1299,8 @@ void AMDGPULibCalls::replaceLibCallWithSimpleIntrinsic(IRBuilder<> &B, } } - CI->setCalledFunction( - Intrinsic::getDeclaration(CI->getModule(), IntrID, {CI->getType()})); + CI->setCalledFunction(Intrinsic::getOrInsertDeclaration( + CI->getModule(), IntrID, {CI->getType()})); } bool AMDGPULibCalls::tryReplaceLibcallWithSimpleIntrinsic( |
