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 @@ -271,6 +271,12 @@ return false; }; + // Short-circuit unnecessary preferred location map construction. + if (VLocs.empty()) { + flushDbgValues(MBB.begin(), &MBB); + return; + } + // Map of the preferred location for each value. std::map ValueToLoc; ActiveMLocs.reserve(VLocs.size());