IRGen: Address llvm::Intrinsic::getDeclaration deprecation

See https://github.com/llvm/llvm-project/pull/112242.
This commit is contained in:
Anthony Latsis
2025-07-21 11:07:57 +01:00
parent 3ba8ab4094
commit db58043b40
3 changed files with 11 additions and 11 deletions

View File

@@ -444,9 +444,9 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
SmallVector<llvm::Type*, 4> ArgTys;
for (auto T : IInfo.Types)
ArgTys.push_back(IGF.IGM.getStorageTypeForLowered(T->getCanonicalType()));
auto F = llvm::Intrinsic::getDeclaration(&IGF.IGM.Module,
(llvm::Intrinsic::ID)IID, ArgTys);
auto F = llvm::Intrinsic::getOrInsertDeclaration(
&IGF.IGM.Module, (llvm::Intrinsic::ID)IID, ArgTys);
llvm::FunctionType *FT = F->getFunctionType();
SmallVector<llvm::Value*, 8> IRArgs;
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i)
@@ -512,7 +512,7 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
SmallVector<llvm::Type *, 2> ArgTys; \
auto opType = Builtin.Types[0]->getCanonicalType(); \
ArgTys.push_back(IGF.IGM.getStorageTypeForLowered(opType)); \
auto F = llvm::Intrinsic::getDeclaration( \
auto F = llvm::Intrinsic::getOrInsertDeclaration( \
&IGF.IGM.Module, getLLVMIntrinsicIDForBuiltinWithOverflow(Builtin.ID), \
ArgTys); \
SmallVector<llvm::Value *, 2> IRArgs; \