[llvm] 75c1d1d - [NFC][SimplifyCFG] Add test showing failure to drop normal dest of noreturn invoke
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 4 15:16:07 PST 2022
Author: Roman Lebedev
Date: 2022-02-05T02:15:07+03:00
New Revision: 75c1d1dab41709a9e0780ad2fbad23e46bfba4dd
URL: https://github.com/llvm/llvm-project/commit/75c1d1dab41709a9e0780ad2fbad23e46bfba4dd
DIFF: https://github.com/llvm/llvm-project/commit/75c1d1dab41709a9e0780ad2fbad23e46bfba4dd.diff
LOG: [NFC][SimplifyCFG] Add test showing failure to drop normal dest of noreturn invoke
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 48f3d90520ba..5aabe6f7449c 100644
--- a/llvm/test/Transforms/SimplifyCFG/invoke.ll
+++ b/llvm/test/Transforms/SimplifyCFG/invoke.ll
@@ -61,7 +61,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]]) #[[ATTR5:[0-9]+]]
+; CHECK-NEXT: tail call void @__cxa_call_unexpected(i8* [[TMP1]]) #[[ATTR6:[0-9]+]]
; CHECK-NEXT: unreachable
;
entry:
@@ -136,7 +136,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:%.*]]) #[[ATTR5]]
+; CHECK-NEXT: tail call void @__cxa_call_unexpected(i8* [[A:%.*]]) #[[ATTR6]]
; CHECK-NEXT: unreachable
;
entry:
@@ -192,4 +192,55 @@ lpad:
ret void
}
+define void @invoke_of_noreturn() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-LABEL: @invoke_of_noreturn(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: invoke void @simple_throw()
+; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
+; CHECK: invoke.cont:
+; CHECK-NEXT: call void @sideeffect(i32 0)
+; CHECK-NEXT: ret void
+; CHECK: lpad:
+; CHECK-NEXT: [[EH:%.*]] = landingpad { i8*, i32 }
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: call void @sideeffect(i32 1)
+; CHECK-NEXT: resume { i8*, i32 } [[EH]]
+;
+entry:
+ invoke void @simple_throw() to label %invoke.cont unwind label %lpad
+
+invoke.cont:
+ call void @sideeffect(i32 0)
+ ret void
+
+lpad:
+ %eh = landingpad { i8*, i32 } cleanup
+ call void @sideeffect(i32 1)
+ resume { i8*, i32 } %eh
+}
+
+define void @invoke_of_nounwind() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+; CHECK-LABEL: @invoke_of_nounwind(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: call void @simple_return()
+; CHECK-NEXT: call void @sideeffect(i32 0)
+; CHECK-NEXT: ret void
+;
+entry:
+ invoke void @simple_return() to label %invoke.cont unwind label %lpad
+
+invoke.cont:
+ call void @sideeffect(i32 0)
+ ret void
+
+lpad:
+ %eh = landingpad { i8*, i32 } cleanup
+ call void @sideeffect(i32 1)
+ resume { i8*, i32 } %eh
+}
+
+declare void @simple_throw() noreturn
+declare void @simple_return() nounwind
+declare void @sideeffect(i32 )
+
attributes #0 = { null_pointer_is_valid }
More information about the llvm-commits
mailing list