forked from OSchip/llvm-project
[VPlan] Preserve debug location when creating branch.
Update createEmptyBasicBlock to preserve the debug location of the previous terminator.
This commit is contained in:
parent
547567fe2b
commit
29fe998eaa
|
@ -280,8 +280,10 @@ VPBasicBlock::createEmptyBasicBlock(VPTransformState::CFGState &CFG) {
|
|||
if (isa<UnreachableInst>(PredBBTerminator)) {
|
||||
assert(PredVPSuccessors.size() == 1 &&
|
||||
"Predecessor ending w/o branch must have single successor.");
|
||||
DebugLoc DL = PredBBTerminator->getDebugLoc();
|
||||
PredBBTerminator->eraseFromParent();
|
||||
BranchInst::Create(NewBB, PredBB);
|
||||
auto *Br = BranchInst::Create(NewBB, PredBB);
|
||||
Br->setDebugLoc(DL);
|
||||
} else {
|
||||
assert(PredVPSuccessors.size() == 2 &&
|
||||
"Predecessor ending with branch must have two successors.");
|
||||
|
|
|
@ -70,8 +70,7 @@ define i32 @test_debug_loc_on_branch_in_loop(i32* noalias %src, i32* noalias %ds
|
|||
; CHECK-NEXT: pred.store.if:
|
||||
; CHECK-NEXT: [[GEP:%.+]] = getelementptr inbounds i32, i32* %dst, i64 {{.+}}, !dbg [[LOC3]]
|
||||
; CHECK-NEXT: store i32 0, i32* [[GEP]], align 4, !dbg [[LOC3]]
|
||||
; CHECK-NEXT: br label %pred.store.continue
|
||||
; CHECK-NOT: !dbg
|
||||
; CHECK-NEXT: br label %pred.store.continue, !dbg [[LOC3]]
|
||||
; CHECK-EMPTY:
|
||||
;
|
||||
entry:
|
||||
|
|
Loading…
Reference in New Issue