[llvm] [DebugInfo][RemoveDIs] Instrument inliner for non-instr debug-info (PR #72884)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 20 07:32:27 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff a2cf44b72cbf9361f37dd6f680502bb18070cba3 beab8550614fd00af8fdd039d0bdd97f6cf271da -- llvm/include/llvm/IR/DebugInfo.h llvm/lib/IR/DebugInfo.cpp llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp llvm/lib/Transforms/Scalar/JumpThreading.cpp llvm/lib/Transforms/Utils/CloneFunction.cpp llvm/lib/Transforms/Utils/CloneModule.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 5ef95543e8..648d9b4c84 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -273,8 +273,8 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
// attached debug-info records.
for (Instruction &II : *BB) {
RemapInstruction(&II, VMap, RemapFlag, TypeMapper, Materializer);
- RemapDPValueRange(II.getModule(), II.getDbgValueRange(), VMap,
- RemapFlag, TypeMapper, Materializer);
+ RemapDPValueRange(II.getModule(), II.getDbgValueRange(), VMap, RemapFlag,
+ TypeMapper, Materializer);
}
// Only update !llvm.dbg.cu for DifferentModule (not CloneModule). In the
@@ -501,18 +501,19 @@ void PruningFunctionCloner::CloneBlock(
// Keep a cursor pointing at the last place we cloned debug-info records from.
BasicBlock::const_iterator DbgCursor = StartingInst;
- auto CloneDbgRecordsToHere = [NewBB,&DbgCursor](Instruction *NewInst, BasicBlock::const_iterator II) {
- if (!NewBB->IsNewDbgInfoFormat)
- return;
-
- // Clone debug-info records onto this instruction. Iterate through any
- // source-instructions we've cloned and then subsequently optimised away,
- // so that their debug-info doesn't go missing.
- for (; DbgCursor != II; ++DbgCursor)
- NewInst->cloneDebugInfoFrom(&*DbgCursor, std::nullopt, false);
- NewInst->cloneDebugInfoFrom(&*II);
- DbgCursor = std::next(II);
- };
+ auto CloneDbgRecordsToHere =
+ [NewBB, &DbgCursor](Instruction *NewInst, BasicBlock::const_iterator II) {
+ if (!NewBB->IsNewDbgInfoFormat)
+ return;
+
+ // Clone debug-info records onto this instruction. Iterate through any
+ // source-instructions we've cloned and then subsequently optimised
+ // away, so that their debug-info doesn't go missing.
+ for (; DbgCursor != II; ++DbgCursor)
+ NewInst->cloneDebugInfoFrom(&*DbgCursor, std::nullopt, false);
+ NewInst->cloneDebugInfoFrom(&*II);
+ DbgCursor = std::next(II);
+ };
// Loop over all instructions, and copy them over, DCE'ing as we go. This
// loop doesn't include the terminator.
@@ -886,8 +887,8 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc,
for (BasicBlock &BB : make_range(Begin, NewFunc->end())) {
for (Instruction &I : BB) {
RemapDPValueRange(I.getModule(), I.getDbgValueRange(), VMap,
- ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges,
- TypeMapper, Materializer);
+ ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges,
+ TypeMapper, Materializer);
}
}
@@ -988,7 +989,7 @@ void llvm::remapInstructionsInBlocks(ArrayRef<BasicBlock *> Blocks,
Module *M = BB->getModule();
for (auto &Inst : *BB) {
RemapDPValueRange(Inst.getModule(), Inst.getDbgValueRange(), VMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
RemapInstruction(&Inst, VMap,
RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
}
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 5d17c008f4..8071bc0593 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1718,14 +1718,15 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
}
DebugLoc DL = DPV->getDebugLoc();
DebugLoc IDL =
- inlineDebugLoc(DL, InlinedAtNode, DPV->getMarker()->getParent()->getContext(), IANodes);
+ inlineDebugLoc(DL, InlinedAtNode,
+ DPV->getMarker()->getParent()->getContext(), IANodes);
DPV->setDebugLoc(IDL);
};
// Iterate over all instructions, updating metadata and debug-info records.
for (; FI != Fn->end(); ++FI) {
- for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
- BI != BE; ++BI) {
+ for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE;
+ ++BI) {
UpdateInst(*BI);
for (DPValue &DPV : BI->getDbgValueRange()) {
UpdateDPV(&DPV);
@@ -1745,7 +1746,6 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
++BI;
}
}
-
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/72884
More information about the llvm-commits
mailing list