[FunctionAttrs] Precommit tests for willreturn inference.

Tests for D94502.
This commit is contained in:
Florian Hahn 2021-01-11 16:33:22 +00:00
parent a14040bd4d
commit 08d4a50467
No known key found for this signature in database
GPG Key ID: 61D7554B5CECDC0D
1 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,72 @@
; RUN: opt -function-attrs -S %s | FileCheck %s
; TODO
define void @mustprogress_readnone() mustprogress {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define void @mustprogress_readnone()
;
entry:
br label %while.body
while.body:
br label %while.body
}
; TODO
define i32 @mustprogress_load(i32* %ptr) mustprogress {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define i32 @mustprogress_load(
;
entry:
%r = load i32, i32* %ptr
ret i32 %r
}
define void @mustprogress_store(i32* %ptr) mustprogress {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define void @mustprogress_store(
;
entry:
store i32 0, i32* %ptr
ret void
}
declare void @unknown_fn()
define void @mustprogress_call_unknown_fn() mustprogress {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define void @mustprogress_call_unknown_fn(
;
call void @unknown_fn()
ret void
}
; TODO
define i32 @mustprogress_call_known_functions(i32* %ptr) mustprogress {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define i32 @mustprogress_call_known_functions(
;
call void @mustprogress_readnone()
%r = call i32 @mustprogress_load(i32* %ptr)
ret i32 %r
}
declare i32 @__gxx_personality_v0(...)
; TODO
define i64 @mustprogress_mayunwind() mustprogress personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
; CHECK-NOT: Function Attrs: {{.*}} willreturn
; CHECK: define i64 @mustprogress_mayunwind(
;
%a = invoke i64 @fn_noread()
to label %A unwind label %B
A:
ret i64 10
B:
%val = landingpad { i8*, i32 }
catch i8* null
ret i64 0
}
declare i64 @fn_noread() readnone