Update createEmptyBasicBlock to preserve the debug location of the
previous terminator.
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.");
; 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: