[llvm] [CodeGen] Avoid generating trap instructions after exception restore intrinsics (PR #109560)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 22 00:24:53 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)) {
+ const auto IID = II->getIntrinsicID();
+ if (IID == Intrinsic::eh_return_i32 || IID == Intrinsic::eh_return_i64)
+ return true;
+ }
----------------
arsenm wrote:
These intrinsics are missing from the langref and I don't know what's expected of them. Should these really be terminators in the first place? Can the insert point just be adjusted?
> use the last instruction in a BB to determine terminator behavior.
This comment doesn't exactly make sense
https://github.com/llvm/llvm-project/pull/109560
More information about the llvm-commits
mailing list