[llvm] RuntimeLibcalls: Account for Triple default exception handling (PR #147224)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 7 21:05:25 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/147224
>From 406324769e4110601fb29f66342c6796c1f01ec8 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 2 Jul 2025 14:45:19 +0900
Subject: [PATCH] RuntimeLibcalls: Account for Triple default exception
handling
Previously we were taking the raw TargetOptions exception mode.
This only works correctly for the TargetLowering usage, when
the -exception-model flag is explicitly used.
The interface isn't great, and interprets none to both mean use
target default and unsupported, such that it's not possible to
opt-out of exceptions on targets that report a non-none default.
We also still get the wrong mode in the linker usecase of
RuntimeLibcalls since it doesn't have the TargetMachine. But at
least wrongly being the default is an improvement over being unset.
I'm not really sure how to write a test for this.
---
llvm/include/llvm/IR/RuntimeLibcalls.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 66d11c4cbabb7..e9db7d1259009 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -60,6 +60,14 @@ struct RuntimeLibcallsInfo {
FloatABI::ABIType FloatABI = FloatABI::Default,
EABI EABIVersion = EABI::Default, StringRef ABIName = "") {
initSoftFloatCmpLibcallPredicates();
+
+ // FIXME: The ExceptionModel parameter is to handle the field in
+ // TargetOptions. This interface fails to distinguish the forced disable
+ // case for targets which support exceptions by default. This should
+ // probably be a module flag and removed from TargetOptions.
+ if (ExceptionModel == ExceptionHandling::None)
+ ExceptionModel = TT.getDefaultExceptionHandling();
+
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
}
More information about the llvm-commits
mailing list