[llvm] [WinEH] Take musttail calls into account when unlinking eh records (PR #119702)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 09:29:49 PST 2024


================
@@ -363,6 +363,16 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
     Instruction *T = BB.getTerminator();
     if (!isa<ReturnInst>(T))
       continue;
+
+    // Back up to any preceding musttail call, the de-facto terminator.
+    Instruction *Prev = T->getPrevNonDebugInstruction();
----------------
rnk wrote:

Let's use `BB.getTerminatingMustTailCall()` to share code and avoid edge cases.

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


More information about the llvm-commits mailing list