Skip to content

Commit 4045ad6

Browse files
committed
[DCE] Add tests for non-willreturn function being removed (NFC)
1 parent fbf8b95 commit 4045ad6

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -adce -S < %s | FileCheck %s
3+
4+
declare void @may_not_return(i32) nounwind readnone
5+
declare void @will_return(i32) nounwind readnone willreturn
6+
7+
; FIXME: This is a miscompile.
8+
define void @test(i32 %a) {
9+
; CHECK-LABEL: @test(
10+
; CHECK-NEXT: ret void
11+
;
12+
%b = add i32 %a, 1
13+
call void @may_not_return(i32 %b)
14+
%c = add i32 %b, 1
15+
call void @will_return(i32 %c)
16+
ret void
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -bdce -S < %s | FileCheck %s
3+
4+
declare void @may_not_return(i32) nounwind readnone
5+
declare void @will_return(i32) nounwind readnone willreturn
6+
7+
; FIXME: This is a miscompile.
8+
define void @test(i32 %a) {
9+
; CHECK-LABEL: @test(
10+
; CHECK-NEXT: ret void
11+
;
12+
%b = add i32 %a, 1
13+
call void @may_not_return(i32 %b)
14+
%c = add i32 %b, 1
15+
call void @will_return(i32 %c)
16+
ret void
17+
}

0 commit comments

Comments
 (0)