summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/call_nonnull_arg.ll
blob: cac53d3d47a96d7f9739e7e4060a1ee123adb880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; RUN: opt < %s -instcombine -S | FileCheck %s

; InstCombine should mark null-checked argument as nonnull at callsite
declare void @dummy(i32*)

define void @test(i32* %a) {
; CHECK-LABEL: @test
; CHECK: call void @dummy(i32* nonnull %a)
entry:
  %cond = icmp eq i32* %a, null
  br i1 %cond, label %is_null, label %not_null
not_null:
  call void @dummy(i32* %a)
  ret void
is_null:
  unreachable
}
OpenPOWER on IntegriCloud