mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IRGen: Address llvm::Intrinsic::getDeclaration deprecation
See https://github.com/llvm/llvm-project/pull/112242.
This commit is contained in:
@@ -445,8 +445,8 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
|
||||
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; \
|
||||
|
||||
@@ -310,8 +310,8 @@ public:
|
||||
// FunctionPointer.
|
||||
|
||||
bool isTrapIntrinsic(llvm::Value *Callee) {
|
||||
return Callee ==
|
||||
llvm::Intrinsic::getDeclaration(getModule(), llvm::Intrinsic::trap);
|
||||
return Callee == llvm::Intrinsic::getOrInsertDeclaration(
|
||||
getModule(), llvm::Intrinsic::trap);
|
||||
}
|
||||
bool isTrapIntrinsic(llvm::Intrinsic::ID intrinsicID) {
|
||||
return intrinsicID == llvm::Intrinsic::trap;
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
const Twine &name = "") {
|
||||
assert(!isTrapIntrinsic(intrinsicID) && "Use CreateNonMergeableTrap");
|
||||
auto intrinsicFn =
|
||||
llvm::Intrinsic::getDeclaration(getModule(), intrinsicID);
|
||||
llvm::Intrinsic::getOrInsertDeclaration(getModule(), intrinsicID);
|
||||
return CreateCallWithoutDbgLoc(
|
||||
cast<llvm::FunctionType>(intrinsicFn->getValueType()), intrinsicFn,
|
||||
args, name);
|
||||
@@ -393,8 +393,8 @@ public:
|
||||
ArrayRef<llvm::Value *> args,
|
||||
const Twine &name = "") {
|
||||
assert(!isTrapIntrinsic(intrinsicID) && "Use CreateNonMergeableTrap");
|
||||
auto intrinsicFn =
|
||||
llvm::Intrinsic::getDeclaration(getModule(), intrinsicID, typeArgs);
|
||||
auto intrinsicFn = llvm::Intrinsic::getOrInsertDeclaration(
|
||||
getModule(), intrinsicID, typeArgs);
|
||||
return CreateCallWithoutDbgLoc(
|
||||
cast<llvm::FunctionType>(intrinsicFn->getValueType()), intrinsicFn,
|
||||
args, name);
|
||||
|
||||
@@ -525,8 +525,8 @@ llvm::CallInst *IRBuilder::CreateNonMergeableTrap(IRGenModule &IGM,
|
||||
}
|
||||
|
||||
// Emit the trap instruction.
|
||||
llvm::Function *trapIntrinsic =
|
||||
llvm::Intrinsic::getDeclaration(&IGM.Module, llvm::Intrinsic::trap);
|
||||
llvm::Function *trapIntrinsic = llvm::Intrinsic::getOrInsertDeclaration(
|
||||
&IGM.Module, llvm::Intrinsic::trap);
|
||||
if (EnableTrapDebugInfo && IGM.DebugInfo && !failureMsg.empty()) {
|
||||
IGM.DebugInfo->addFailureMessageToCurrentLoc(*this, failureMsg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user