1 ; RUN: opt -S -instcombine < %s | FileCheck %s
3 declare void @callee(i8* %arg)
5 ; Positive test - arg is known non null
6 define void @test(i8* nonnull %arg) {
8 ; CHECK: call void @callee(i8* nonnull %arg)
9 call void @callee(i8* %arg)
14 ; Negative test - arg is not known to be non null
15 define void @test2(i8* %arg) {
17 ; CHECK: call void @callee(i8* %arg)
18 call void @callee(i8* %arg)
22 declare void @callee2(i8*, i8*, i8*)
24 ; Sanity check arg indexing
25 define void @test3(i8* %arg1, i8* nonnull %arg2, i8* %arg3) {
27 ; CHECK: call void @callee2(i8* %arg1, i8* nonnull %arg2, i8* %arg3)
28 call void @callee2(i8* %arg1, i8* %arg2, i8* %arg3)
32 ; Because of the way CallSite::paramHasAttribute looks at the callee
33 ; directly, we will not set the attribute on the CallSite. That's
34 ; fine as long as all consumers use the same check.
35 define void @test4(i8* nonnull %arg) {
37 ; CHECK: call void @test4(i8* %arg)
38 call void @test4(i8* %arg)