diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h @@ -1094,7 +1094,7 @@ MLocTracker *MTracker = nullptr; /// Number of the current block LiveDebugValues is stepping through. - unsigned CurBB; + unsigned CurBB = -1; /// Number of the current instruction LiveDebugValues is evaluating. unsigned CurInst; diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp @@ -1070,6 +1070,7 @@ break; } } + assert(CurBB != -1u); LocIdxToIDNum[NewIdx] = ValNum; LocIdxToLocID[NewIdx] = ID;