From 92aec5192ce752c984837a93227200b54faa8679 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Fri, 9 Aug 2024 10:17:48 +0100 Subject: [DebugInfo][RemoveDIs] Use iterator-inserters in clang (#102006) As part of the LLVM effort to eliminate debug-info intrinsics, we're moving to a world where only iterators should be used to insert instructions. This isn't a problem in clang when instructions get generated before any debug-info is inserted, however we're planning on deprecating and removing the instruction-pointer insertion routines. Scatter some calls to getIterator in a few places, remove a deref-then-addrof on another iterator, and add an overload for the createLoadInstBefore utility. Some callers passes a null insertion point, which we need to handle explicitly now. --- clang/lib/CodeGen/CodeGenModule.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 9aaf90c..6d11bd1 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5911,13 +5911,13 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old, llvm::CallBase *newCall; if (isa(callSite)) { - newCall = - llvm::CallInst::Create(newFn, newArgs, newBundles, "", callSite); + newCall = llvm::CallInst::Create(newFn, newArgs, newBundles, "", + callSite->getIterator()); } else { auto *oldInvoke = cast(callSite); - newCall = llvm::InvokeInst::Create(newFn, oldInvoke->getNormalDest(), - oldInvoke->getUnwindDest(), newArgs, - newBundles, "", callSite); + newCall = llvm::InvokeInst::Create( + newFn, oldInvoke->getNormalDest(), oldInvoke->getUnwindDest(), + newArgs, newBundles, "", callSite->getIterator()); } newArgs.clear(); // for the next iteration -- cgit v1.1