[llvm] [CodeGen] Avoid generating trap instructions after exception restore intrinsics (PR #109560)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 12:50:56 PDT 2024


================
@@ -3125,6 +3125,14 @@ bool IRTranslator::translateUnreachable(const User &U, MachineIRBuilder &MIRBuil
     // Do not emit an additional trap instruction.
     if (Call->isNonContinuableTrap())
       return true;
+    // Do not emit trap instructions after EH_RETURN intrinsics.
+    // This can cause problems later down the line when other machine passes
+    // attempt to use the last instruction in a BB to determine terminator behavior.
+    if (const auto *II = dyn_cast<IntrinsicInst>(Call)) {
----------------
arsenm wrote:

Should these be handled in isNonContinuableTrap? 

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


More information about the llvm-commits mailing list