Skip to content

Commit 32f461b

Browse files
authored
RuntimeLibcalls: Account for Triple default exception handling (#147224)
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.
1 parent 4c98da2 commit 32f461b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ struct RuntimeLibcallsInfo {
6060
FloatABI::ABIType FloatABI = FloatABI::Default,
6161
EABI EABIVersion = EABI::Default, StringRef ABIName = "") {
6262
initSoftFloatCmpLibcallPredicates();
63+
64+
// FIXME: The ExceptionModel parameter is to handle the field in
65+
// TargetOptions. This interface fails to distinguish the forced disable
66+
// case for targets which support exceptions by default. This should
67+
// probably be a module flag and removed from TargetOptions.
68+
if (ExceptionModel == ExceptionHandling::None)
69+
ExceptionModel = TT.getDefaultExceptionHandling();
70+
6371
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
6472
}
6573

0 commit comments

Comments
 (0)