[llvm] Change default exception model to Default in RuntimeLibcallsInfo (PR #228555)
Devon Loehr via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 3 06:03:29 PDT 2026
https://github.com/DKLoehr updated https://github.com/llvm/llvm-project/pull/228555
>From 1a5ba85408ba5fc191fd809e13b38bf3aba83654 Mon Sep 17 00:00:00 2001
From: Devon Loehr <dloehr at google.com>
Date: Fri, 2 Oct 2026 19:14:15 +0000
Subject: [PATCH 1/3] Change default exception model to Default
---
llvm/include/llvm/IR/RuntimeLibcalls.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 4ea0a7854f8254..54ba52e2edda6b 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -87,7 +87,7 @@ struct RuntimeLibcallsInfo {
LLVM_ABI explicit RuntimeLibcallsInfo(
const Triple &TT,
- ExceptionHandling ExceptionModel = ExceptionHandling::None,
+ ExceptionHandling ExceptionModel = ExceptionHandling::Default,
FloatABI::ABIType FloatABI = FloatABI::Default, StringRef ABIName = "",
VectorLibrary VecLib = VectorLibrary::NoLibrary);
>From b99ea3fbbc0edc90821467b335486d7d250fd589 Mon Sep 17 00:00:00 2001
From: Devon Loehr <dloehr at google.com>
Date: Sat, 3 Oct 2026 01:37:31 +0000
Subject: [PATCH 2/3] Add tests
---
llvm/test/LTO/Resolution/X86/libcall-in-tu.ll | 11 +++++++++--
llvm/unittests/IR/RuntimeLibcallsTest.cpp | 9 +++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/llvm/test/LTO/Resolution/X86/libcall-in-tu.ll b/llvm/test/LTO/Resolution/X86/libcall-in-tu.ll
index cddf5d30697d0e..3f2d08181e6de8 100644
--- a/llvm/test/LTO/Resolution/X86/libcall-in-tu.ll
+++ b/llvm/test/LTO/Resolution/X86/libcall-in-tu.ll
@@ -8,7 +8,8 @@
; RUN: -r %t.o,foo,plx \
; RUN: -r %t.o,memcmp,x \
; RUN: -r %t.o,bcmp,pl \
-; RUN: -r %t.o,bcmp_impl,x %t.o -save-temps
+; RUN: -r %t.o,bcmp_impl,x \
+; RUN: -r %t.o,_Unwind_Resume,pl %t.o -save-temps
; RUN: llvm-dis %t.lto.o.0.4.opt.bc -o - | FileCheck %s
define i1 @foo(ptr %0, ptr %1, i64 %2) {
@@ -25,10 +26,16 @@ define i1 @foo(ptr %0, ptr %1, i64 %2) {
declare i32 @memcmp(ptr, ptr, i64)
declare i32 @bcmp_impl(ptr, ptr, i64)
-;; Ensure bcmp is not removed from module because it is external.
+;; Ensure bcmp and _Unwind_Resume are not removed from module
+;; because they are external libcalls.
; CHECK: define dso_local i32 @bcmp
define i32 @bcmp(ptr %0, ptr %1, i64 %2) noinline {
%r = call i32 @bcmp_impl(ptr %0, ptr %1, i64 %2)
ret i32 %r
}
+; CHECK: define dso_local void @_Unwind_Resume
+define void @_Unwind_Resume(ptr %0) noinline {
+ ret void
+}
+
diff --git a/llvm/unittests/IR/RuntimeLibcallsTest.cpp b/llvm/unittests/IR/RuntimeLibcallsTest.cpp
index 22cff2ddfa610f..afd2bdd379983b 100644
--- a/llvm/unittests/IR/RuntimeLibcallsTest.cpp
+++ b/llvm/unittests/IR/RuntimeLibcallsTest.cpp
@@ -185,4 +185,13 @@ TEST(RuntimeLibcallsTest, LibcallForIntrinsic) {
RTLIB::UNKNOWN_LIBCALL);
}
+TEST(RuntimeLibcallsTest, DefaultExceptionModel) {
+ Triple TT("x86_64-unknown-linux-gnu");
+ RTLIB::RuntimeLibcallsInfo DefaultInfo(TT);
+ EXPECT_TRUE(DefaultInfo.isAvailable(RTLIB::impl__Unwind_Resume));
+
+ RTLIB::RuntimeLibcallsInfo NoneInfo(TT, ExceptionHandling::None);
+ EXPECT_FALSE(NoneInfo.isAvailable(RTLIB::impl__Unwind_Resume));
+}
+
} // namespace
>From 58f7c98fa3338b04363aa48987565241aec50138 Mon Sep 17 00:00:00 2001
From: Devon Loehr <dloehr at google.com>
Date: Sat, 3 Oct 2026 13:02:59 +0000
Subject: [PATCH 3/3] Remove one test
---
llvm/unittests/IR/RuntimeLibcallsTest.cpp | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/llvm/unittests/IR/RuntimeLibcallsTest.cpp b/llvm/unittests/IR/RuntimeLibcallsTest.cpp
index afd2bdd379983b..22cff2ddfa610f 100644
--- a/llvm/unittests/IR/RuntimeLibcallsTest.cpp
+++ b/llvm/unittests/IR/RuntimeLibcallsTest.cpp
@@ -185,13 +185,4 @@ TEST(RuntimeLibcallsTest, LibcallForIntrinsic) {
RTLIB::UNKNOWN_LIBCALL);
}
-TEST(RuntimeLibcallsTest, DefaultExceptionModel) {
- Triple TT("x86_64-unknown-linux-gnu");
- RTLIB::RuntimeLibcallsInfo DefaultInfo(TT);
- EXPECT_TRUE(DefaultInfo.isAvailable(RTLIB::impl__Unwind_Resume));
-
- RTLIB::RuntimeLibcallsInfo NoneInfo(TT, ExceptionHandling::None);
- EXPECT_FALSE(NoneInfo.isAvailable(RTLIB::impl__Unwind_Resume));
-}
-
} // namespace
More information about the llvm-commits
mailing list