[llvm] e3f5cbd - [FunctionAttrs] Add more nounwind tests (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 01:54:23 PDT 2023
Author: Nikita Popov
Date: 2023-04-06T10:54:15+02:00
New Revision: e3f5cbd9c006382b7084d877b8f022bea6093293
URL: https://github.com/llvm/llvm-project/commit/e3f5cbd9c006382b7084d877b8f022bea6093293
DIFF: https://github.com/llvm/llvm-project/commit/e3f5cbd9c006382b7084d877b8f022bea6093293.diff
LOG: [FunctionAttrs] Add more nounwind tests (NFC)
Test variations where catch/filter catch all exceptions.
Added:
Modified:
llvm/test/Transforms/FunctionAttrs/nounwind.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/FunctionAttrs/nounwind.ll b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
index 9adf5beefbee..4d52e61234ff 100644
--- a/llvm/test/Transforms/FunctionAttrs/nounwind.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
@@ -129,9 +129,9 @@ declare void @do_throw()
declare void @abort() nounwind
@catch_ty = external global ptr
-define void @catch_landingpad() personality ptr @__gxx_personality_v0 {
+define void @catch_specific_landingpad() personality ptr @__gxx_personality_v0 {
; CHECK: Function Attrs: noreturn nounwind
-; CHECK-LABEL: define {{[^@]+}}@catch_landingpad
+; CHECK-LABEL: define {{[^@]+}}@catch_specific_landingpad
; CHECK-SAME: () #[[ATTR3:[0-9]+]] personality ptr @__gxx_personality_v0 {
; CHECK-NEXT: invoke void @do_throw()
; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
@@ -156,6 +156,87 @@ unreachable:
unreachable
}
+define void @catch_all_landingpad() personality ptr @__gxx_personality_v0 {
+; CHECK: Function Attrs: noreturn nounwind
+; CHECK-LABEL: define {{[^@]+}}@catch_all_landingpad
+; CHECK-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT: invoke void @do_throw()
+; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; CHECK: lpad:
+; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: call void @abort()
+; CHECK-NEXT: unreachable
+; CHECK: unreachable:
+; CHECK-NEXT: unreachable
+;
+ invoke void @do_throw()
+ to label %unreachable unwind label %lpad
+
+lpad:
+ %lp = landingpad { ptr, i32 }
+ catch ptr null
+ call void @abort()
+ unreachable
+
+unreachable:
+ unreachable
+}
+
+define void @filter_specific_landingpad() personality ptr @__gxx_personality_v0 {
+; CHECK: Function Attrs: noreturn nounwind
+; CHECK-LABEL: define {{[^@]+}}@filter_specific_landingpad
+; CHECK-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT: invoke void @do_throw()
+; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; CHECK: lpad:
+; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: filter [1 x ptr] [ptr @catch_ty]
+; CHECK-NEXT: call void @abort()
+; CHECK-NEXT: unreachable
+; CHECK: unreachable:
+; CHECK-NEXT: unreachable
+;
+ invoke void @do_throw()
+ to label %unreachable unwind label %lpad
+
+lpad:
+ %lp = landingpad { ptr, i32 }
+ filter [1 x ptr] [ptr @catch_ty]
+ call void @abort()
+ unreachable
+
+unreachable:
+ unreachable
+}
+
+define void @filter_none_landingpad() personality ptr @__gxx_personality_v0 {
+; CHECK: Function Attrs: noreturn nounwind
+; CHECK-LABEL: define {{[^@]+}}@filter_none_landingpad
+; CHECK-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT: invoke void @do_throw()
+; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; CHECK: lpad:
+; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: filter [0 x ptr] zeroinitializer
+; CHECK-NEXT: call void @abort()
+; CHECK-NEXT: unreachable
+; CHECK: unreachable:
+; CHECK-NEXT: unreachable
+;
+ invoke void @do_throw()
+ to label %unreachable unwind label %lpad
+
+lpad:
+ %lp = landingpad { ptr, i32 }
+ filter [0 x ptr] zeroinitializer
+ call void @abort()
+ unreachable
+
+unreachable:
+ unreachable
+}
+
define void @cleanup_landingpad() personality ptr @__gxx_personality_v0 {
; CHECK: Function Attrs: noreturn nounwind
; CHECK-LABEL: define {{[^@]+}}@cleanup_landingpad
More information about the llvm-commits
mailing list