[InstCombine] auto-generate checks; NFC

llvm-svn: 289959
This commit is contained in:
Sanjay Patel 2016-12-16 16:58:54 +00:00
parent 099af810de
commit 2d82aa7af7
1 changed files with 15 additions and 2 deletions

View File

@ -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,4 @@ not_zero:
dead:
unreachable
}