[llvm] RuntimeLibcalls: Account for Triple default exception handling (PR #147224)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 7 17:59:36 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/147224
>From e5a155678989a7771946e06a948f07b4f91d7a84 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 50b9791111ce2..9470d22bcad31 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -53,6 +53,14 @@ struct RuntimeLibcallsInfo {
EABI EABIVersion = EABI::Default, StringRef ABIName = "") {
initSoftFloatCmpLibcallPredicates();
initDefaultLibCallImpls();
+
+ // 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