Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions llvm/lib/Transforms/Scalar/JumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,6 @@ bool JumpThreadingPass::runImpl(Function &F_, FunctionAnalysisManager *FAM_,
while (processBlock(&BB)) // Thread all of the branches we can over BB.
Changed = ChangedSinceLastAnalysisUpdate = true;

// Jump threading may have introduced redundant debug values into BB
// which should be removed.
if (Changed)
RemoveRedundantDbgInstrs(&BB);

// Stop processing BB if it's the entry or is now deleted. The following
// routines attempt to eliminate BB and locating a suitable replacement
// for the entry is non-trivial.
Expand Down Expand Up @@ -366,7 +361,6 @@ bool JumpThreadingPass::runImpl(Function &F_, FunctionAnalysisManager *FAM_,
// detect and transform nested loops later.
!LoopHeaders.count(&BB) && !LoopHeaders.count(Succ) &&
TryToSimplifyUncondBranchFromEmptyBlock(&BB, DTU.get())) {
RemoveRedundantDbgInstrs(Succ);
// BB is valid for cleanup here because we passed in DTU. F remains
// BB's parent until a DTU->getDomTree() event.
LVI->eraseBlock(&BB);
Expand All @@ -377,6 +371,13 @@ bool JumpThreadingPass::runImpl(Function &F_, FunctionAnalysisManager *FAM_,
EverChanged |= Changed;
} while (Changed);

// Jump threading may have introduced redundant debug values into BB which
// should be removed.
if (EverChanged)
for (auto &BB : *F) {
RemoveRedundantDbgInstrs(&BB);
}

LoopHeaders.clear();
return EverChanged;
}
Expand Down
5 changes: 0 additions & 5 deletions llvm/test/Transforms/JumpThreading/thread-debug-info.ll
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ exit: ; preds = %bb.f4, %bb.f3, %bb.
ret void, !dbg !29
}

; Test for the cloning of dbg.values on elided instructions -- down one path
; being threaded, the `and` in the function below is optimised away, but its
; debug-info should still be preserved.
; Similarly, the call to f1 gets cloned, its dbg.value should be cloned too.
define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp !dbg !30 {
; CHECK-LABEL: define void @test16(i1
entry:
Expand All @@ -109,7 +105,6 @@ lor.lhs.false.i:
br i1 %c3, label %land.end, label %land.end, !dbg !33

; CHECK-LABEL: land.end.thr_comm:
; CHECK-NEXT: #dbg_value(i32 0,
; CHECK-NEXT: #dbg_value(i32 1,
; CHECK-NEXT: call void @f1()
; CHECK-NEXT: br i1 %c4,
Expand Down
Loading