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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-01-30 01:55:25 +00:00
parent 99a3df3401
commit e413c8afe0
2 changed files with 149 additions and 0 deletions

View File

@ -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<AllocaInst>(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;