[InlineFunction] Refactor code in function `fixupLineNumbers' as suggested by David in D27462. NFC

llvm-svn: 288901
This commit is contained in:
Andrea Di Biagio 2016-12-07 12:01:45 +00:00
parent 615bac37cd
commit eff22832c0
1 changed files with 19 additions and 17 deletions

View File

@ -1372,24 +1372,26 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
for (; FI != Fn->end(); ++FI) {
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
BI != BE; ++BI) {
DebugLoc DL = BI->getDebugLoc();
if (!DL) {
if (CalleeHasDebugInfo)
continue;
// If the inlined instruction has no line number, make it look as if it
// originates from the call location. This is important for
// ((__always_inline__, __nodebug__)) functions which must use caller
// location for all instructions in their function body.
// Don't update static allocas, as they may get moved later.
if (auto *AI = dyn_cast<AllocaInst>(BI))
if (allocaWouldBeStaticInEntry(AI))
continue;
BI->setDebugLoc(TheCallDL);
} else {
BI->setDebugLoc(updateInlinedAtInfo(DL, InlinedAtNode, BI->getContext(), IANodes));
if (DebugLoc DL = BI->getDebugLoc()) {
BI->setDebugLoc(
updateInlinedAtInfo(DL, InlinedAtNode, BI->getContext(), IANodes));
continue;
}
if (CalleeHasDebugInfo)
continue;
// If the inlined instruction has no line number, make it look as if it
// originates from the call location. This is important for
// ((__always_inline__, __nodebug__)) functions which must use caller
// location for all instructions in their function body.
// Don't update static allocas, as they may get moved later.
if (auto *AI = dyn_cast<AllocaInst>(BI))
if (allocaWouldBeStaticInEntry(AI))
continue;
BI->setDebugLoc(TheCallDL);
}
}
}