Skip to content

Commit 393108c

Browse files
committed
Handle review comments.
Fix style and formatting issues.
1 parent 73c78cb commit 393108c

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

llvm/lib/Transforms/Utils/CodeExtractor.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,10 +1242,10 @@ static void eraseDebugIntrinsicsWithNonLocalRefs(Function &F) {
12421242
/// Fix up the debug info in the old and new functions. Following changes are
12431243
/// done.
12441244
/// 1. If a debug record points to a value that has been replaced, update the
1245-
/// record to use the new value.
1245+
/// record to use the new value.
12461246
/// 2. If an Input value that has been replaced was used as a location of a
1247-
/// debug record in the Parent function, then materealize a similar record in
1248-
/// the new function.
1247+
/// debug record in the Parent function, then materealize a similar record in
1248+
/// the new function.
12491249
/// 3. Point line locations and debug intrinsics to the new subprogram scope
12501250
/// 4. Remove intrinsics which point to values outside of the new function.
12511251
static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
@@ -1280,17 +1280,18 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
12801280

12811281
auto UpdateOrInsertDebugRecord = [&](auto *DR, Value *OldLoc, Value *NewLoc,
12821282
DIExpression *Expr, bool Declare) {
1283-
if (DR->getParent()->getParent() == &NewFunc)
1283+
if (DR->getParent()->getParent() == &NewFunc) {
12841284
DR->replaceVariableLocationOp(OldLoc, NewLoc);
1285-
else {
1286-
if (Declare)
1287-
DIB.insertDeclare(NewLoc, DR->getVariable(), Expr, DR->getDebugLoc(),
1288-
&NewFunc.getEntryBlock());
1289-
else
1290-
DIB.insertDbgValueIntrinsic(
1291-
NewLoc, DR->getVariable(), Expr, DR->getDebugLoc(),
1292-
NewFunc.getEntryBlock().getTerminator()->getIterator());
1285+
return;
1286+
}
1287+
if (Declare) {
1288+
DIB.insertDeclare(NewLoc, DR->getVariable(), Expr, DR->getDebugLoc(),
1289+
&NewFunc.getEntryBlock());
1290+
return;
12931291
}
1292+
DIB.insertDbgValueIntrinsic(
1293+
NewLoc, DR->getVariable(), Expr, DR->getDebugLoc(),
1294+
NewFunc.getEntryBlock().getTerminator()->getIterator());
12941295
};
12951296
for (auto [Input, NewVal] : zip_equal(Inputs, NewValues)) {
12961297
SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
@@ -1317,7 +1318,7 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
13171318

13181319
if (Argument *Arg = dyn_cast<Argument>(Location))
13191320
return Arg->getParent() != &NewFunc;
1320-
else if (Instruction *LocationInst = dyn_cast<Instruction>(Location))
1321+
if (Instruction *LocationInst = dyn_cast<Instruction>(Location))
13211322
return LocationInst->getFunction() != &NewFunc;
13221323
return false;
13231324
};

0 commit comments

Comments
 (0)