[llvm] [DLCov][NFC] Annotate intentionally-blank DebugLocs in existing code (PR #136192)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 12:04:28 PDT 2025


================
@@ -419,7 +419,8 @@ static bool processSwitch(SwitchInst *I, LazyValueInfo *LVI,
         BasicBlock *NewUnreachableBB =
             BasicBlock::Create(BB->getContext(), "default.unreachable",
                                BB->getParent(), DefaultDest);
-        new UnreachableInst(BB->getContext(), NewUnreachableBB);
+        auto *UI = new UnreachableInst(BB->getContext(), NewUnreachableBB);
+        UI->setDebugLoc(DebugLoc::getTemporary());
----------------
SLTozer wrote:

"Temporary" is used for instructions that won't have generated machine code, i.e. when we finish compilation, we wouldn't expect to see any line table entry for that instruction. `UnreachableInst`s are the most typical case of this, though there may be exceptions (off the top of my head there might be a case in the LoopVectorizer where we assign a meaningful DebugLoc to an unreachable).

https://github.com/llvm/llvm-project/pull/136192


More information about the llvm-commits mailing list