[llvm] [llvm-profgen] Guard unwindReturn against zero call address (PR #211381)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 10:50:05 PDT 2026


================
@@ -169,6 +169,14 @@ void VirtualUnwinder::unwindReturn(UnwindState &State) {
   // Add extra frame as we unwind through the return
   const LBREntry &LBR = State.getCurrentLBR();
   uint64_t CallAddr = Binary->getCallAddrFromFrameAddr(LBR.Target);
+  if (!CallAddr) {
+    // The return target is not preceded by a call instruction. This can happen
+    // with a broken LBR trace or a return into a function whose frame-pointer
+    // chain wasn't set up. Stop unwinding the rest of the trace rather than
----------------
WenleiHe wrote:

> with a broken LBR trace 

The assert is doing its job. Why are we having corrupted LBR and why is it only happening now after so long? Is it arm only? that seems to be the root cause that needs to be fixed? 

> a return into a function whose frame-pointer chain wasn't set up

What is the actual code that led to this? 

I'm a bit hesitant to go with this fix just yet, because it's essentially suppressing the assert that is doing its job to flag underlying issues to us. 

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


More information about the llvm-commits mailing list