From 4d365250ec2ae22f031d5769c045694504c8f0be Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 30 Jan 2015 01:55:25 +0000 Subject: Fix PR22386. The inliner moves static allocas to the entry basic block so we need to move the dbg.declare intrinsics that describe them, too. llvm-svn: 227544 --- llvm/lib/Transforms/Utils/InlineFunction.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp') diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 7386186..313728c0 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1111,6 +1111,14 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI, FirstNewBlock->getInstList(), AI, I); } + // Move any dbg.declares describing the allocas into the entry basic block. + for (auto &I : IFI.StaticAllocas) + if (auto AI = dyn_cast(I)) + if (auto *DDI = FindAllocaDbgDeclare(AI)) + if (DDI->getParent() != Caller->begin()) + Caller->getEntryBlock().getInstList() + .splice(AI->getNextNode(), FirstNewBlock->getInstList(), + DDI, DDI->getNextNode()); } bool InlinedMustTailCalls = false; -- cgit v1.1