[llvm] 1f1de06 - [SimplifyCFG] Add test for invoke of nounwind non-willreturn function (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon May 30 06:36:40 PDT 2022
Author: Nikita Popov
Date: 2022-05-30T15:36:33+02:00
New Revision: 1f1de06165bb39f66049cdc942151fc6ed193123
URL: https://github.com/llvm/llvm-project/commit/1f1de06165bb39f66049cdc942151fc6ed193123
DIFF: https://github.com/llvm/llvm-project/commit/1f1de06165bb39f66049cdc942151fc6ed193123.diff
LOG: [SimplifyCFG] Add test for invoke of nounwind non-willreturn function (NFC)
Test both the case with and without willreturn attribute.
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/invoke.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/invoke.ll b/llvm/test/Transforms/SimplifyCFG/invoke.ll
index e3bee6f8ac432..ef0067f189339 100644
--- a/llvm/test/Transforms/SimplifyCFG/invoke.ll
+++ b/llvm/test/Transforms/SimplifyCFG/invoke.ll
@@ -4,8 +4,9 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
declare i32 @__gxx_personality_v0(...)
declare void @__cxa_call_unexpected(i8*)
-declare void @purefn() nounwind readnone
-declare i32 @read_only() nounwind readonly
+declare void @purefn() nounwind readnone willreturn
+declare i32 @readonly() nounwind readonly
+declare i32 @readonly_willreturn() nounwind readonly willreturn
declare i32 @nounwind_fn() nounwind
declare i32 @fn()
@@ -61,7 +62,7 @@ define i8* @f2_no_null_opt() nounwind uwtable ssp #0 personality i8* bitcast (i3
; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: filter [0 x i8*] zeroinitializer
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i8*, i32 } [[TMP0]], 0
-; CHECK-NEXT: tail call void @__cxa_call_unexpected(i8* [[TMP1]]) #[[ATTR6:[0-9]+]]
+; CHECK-NEXT: tail call void @__cxa_call_unexpected(i8* [[TMP1]]) #[[ATTR7:[0-9]+]]
; CHECK-NEXT: unreachable
;
entry:
@@ -79,13 +80,13 @@ lpad:
unreachable
}
-define i32 @f3() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
-; CHECK-LABEL: @f3(
+define i32 @invoke_readonly_may_not_return() nounwind personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-LABEL: @invoke_readonly_may_not_return(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 3
;
entry:
- %call = invoke i32 @read_only()
+ %call = invoke i32 @readonly()
to label %invoke.cont unwind label %lpad
invoke.cont:
@@ -99,14 +100,34 @@ lpad:
unreachable
}
-define i32 @f4() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
-; CHECK-LABEL: @f4(
+define i32 @invoke_readonly_willreturn() nounwind personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-LABEL: @invoke_readonly_willreturn(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CALL:%.*]] = call i32 @read_only()
+; CHECK-NEXT: ret i32 3
+;
+entry:
+ %call = invoke i32 @readonly_willreturn()
+ to label %invoke.cont unwind label %lpad
+
+invoke.cont:
+ ret i32 3
+
+lpad:
+ %0 = landingpad { i8*, i32 }
+ filter [0 x i8*] zeroinitializer
+ %1 = extractvalue { i8*, i32 } %0, 0
+ tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind
+ unreachable
+}
+
+define i32 @invoke_readonly_willreturn_with_used_retval() nounwind personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-LABEL: @invoke_readonly_willreturn_with_used_retval(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @readonly_willreturn()
; CHECK-NEXT: ret i32 [[CALL]]
;
entry:
- %call = invoke i32 @read_only()
+ %call = invoke i32 @readonly_willreturn()
to label %invoke.cont unwind label %lpad
invoke.cont:
@@ -136,7 +157,7 @@ define i32 @f5(i1 %cond, i8* %a, i8* %b) personality i8* bitcast (i32 (...)* @__
; CHECK: lpad:
; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
; CHECK-NEXT: filter [0 x i8*] zeroinitializer
-; CHECK-NEXT: tail call void @__cxa_call_unexpected(i8* [[A:%.*]]) #[[ATTR6]]
+; CHECK-NEXT: tail call void @__cxa_call_unexpected(i8* [[A:%.*]]) #[[ATTR7]]
; CHECK-NEXT: unreachable
;
entry:
More information about the llvm-commits
mailing list