[DCE] Add tests for non-willreturn function being removed (NFC)
This commit is contained in:
parent
fbf8b957fd
commit
4045ad6b0c
|
|
@ -0,0 +1,17 @@
|
||||||
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||||
|
; RUN: opt -adce -S < %s | FileCheck %s
|
||||||
|
|
||||||
|
declare void @may_not_return(i32) nounwind readnone
|
||||||
|
declare void @will_return(i32) nounwind readnone willreturn
|
||||||
|
|
||||||
|
; FIXME: This is a miscompile.
|
||||||
|
define void @test(i32 %a) {
|
||||||
|
; CHECK-LABEL: @test(
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
;
|
||||||
|
%b = add i32 %a, 1
|
||||||
|
call void @may_not_return(i32 %b)
|
||||||
|
%c = add i32 %b, 1
|
||||||
|
call void @will_return(i32 %c)
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||||
|
; RUN: opt -bdce -S < %s | FileCheck %s
|
||||||
|
|
||||||
|
declare void @may_not_return(i32) nounwind readnone
|
||||||
|
declare void @will_return(i32) nounwind readnone willreturn
|
||||||
|
|
||||||
|
; FIXME: This is a miscompile.
|
||||||
|
define void @test(i32 %a) {
|
||||||
|
; CHECK-LABEL: @test(
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
;
|
||||||
|
%b = add i32 %a, 1
|
||||||
|
call void @may_not_return(i32 %b)
|
||||||
|
%c = add i32 %b, 1
|
||||||
|
call void @will_return(i32 %c)
|
||||||
|
ret void
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue