diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:17:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:17:04 +0000 |
commit | b915e9e0fc85ba6f398b3fab0db6a81a8913af94 (patch) | |
tree | 98b8f811c7aff2547cab8642daf372d6c59502fb /test/Transforms/InstCombine/call_nonnull_arg.ll | |
parent | 6421cca32f69ac849537a3cff78c352195e99f1b (diff) | |
download | src-b915e9e0fc85ba6f398b3fab0db6a81a8913af94.tar.gz src-b915e9e0fc85ba6f398b3fab0db6a81a8913af94.zip |
Vendor import of llvm trunk r290819:vendor/llvm/llvm-trunk-r290819
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=311116
svn path=/vendor/llvm/llvm-trunk-r290819/; revision=311117; tag=vendor/llvm/llvm-trunk-r290819
Diffstat (limited to 'test/Transforms/InstCombine/call_nonnull_arg.ll')
-rw-r--r-- | test/Transforms/InstCombine/call_nonnull_arg.ll | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/call_nonnull_arg.ll b/test/Transforms/InstCombine/call_nonnull_arg.ll index b10411f622be..c502aa05731e 100644 --- a/test/Transforms/InstCombine/call_nonnull_arg.ll +++ b/test/Transforms/InstCombine/call_nonnull_arg.ll @@ -1,11 +1,23 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s ; InstCombine should mark null-checked argument as nonnull at callsite declare void @dummy(i32*, i32) define void @test(i32* %a, i32 %b) { -; CHECK-LABEL: @test -; CHECK: call void @dummy(i32* nonnull %a, i32 %b) +; CHECK-LABEL: @test( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[COND1:%.*]] = icmp eq i32* %a, null +; CHECK-NEXT: br i1 [[COND1]], label %dead, label %not_null +; CHECK: not_null: +; CHECK-NEXT: [[COND2:%.*]] = icmp eq i32 %b, 0 +; CHECK-NEXT: br i1 [[COND2]], label %dead, label %not_zero +; CHECK: not_zero: +; CHECK-NEXT: call void @dummy(i32* nonnull %a, i32 %b) +; CHECK-NEXT: ret void +; CHECK: dead: +; CHECK-NEXT: unreachable +; entry: %cond1 = icmp eq i32* %a, null br i1 %cond1, label %dead, label %not_null @@ -18,3 +30,21 @@ not_zero: dead: unreachable } + +; FIXME: The nonnull attribute in the 'bar' declaration could be +; propagated to the parameters of the 'baz' callsite. + +declare void @bar(i8*, i8* nonnull) +declare void @baz(i8*, i8*) + +define void @deduce_nonnull_from_another_call(i8* %a, i8* %b) { +; CHECK-LABEL: @deduce_nonnull_from_another_call( +; CHECK-NEXT: call void @bar(i8* %a, i8* %b) +; CHECK-NEXT: call void @baz(i8* %b, i8* %b) +; CHECK-NEXT: ret void +; + call void @bar(i8* %a, i8* %b) + call void @baz(i8* %b, i8* %b) + ret void +} + |