1 ; RUN: llc -O3 -mtriple=x86_64-apple-macosx -enable-implicit-null-checks < %s | FileCheck %s
3 define i32 @imp_null_check_load(i32* %x) {
4 ; CHECK-LABEL: _imp_null_check_load:
6 ; CHECK: movl (%rdi), %eax
9 ; CHECK: movl $42, %eax
13 %c = icmp eq i32* %x, null
14 br i1 %c, label %is_null, label %not_null
20 %t = load i32, i32* %x
24 define i32 @imp_null_check_gep_load(i32* %x) {
25 ; CHECK-LABEL: _imp_null_check_gep_load:
27 ; CHECK: movl 128(%rdi), %eax
30 ; CHECK: movl $42, %eax
34 %c = icmp eq i32* %x, null
35 br i1 %c, label %is_null, label %not_null
41 %x.gep = getelementptr i32, i32* %x, i32 32
42 %t = load i32, i32* %x.gep
46 define i32 @imp_null_check_add_result(i32* %x, i32 %p) {
47 ; CHECK-LABEL: _imp_null_check_add_result:
49 ; CHECK: addl (%rdi), %esi
50 ; CHECK: movl %esi, %eax
53 ; CHECK: movl $42, %eax
57 %c = icmp eq i32* %x, null
58 br i1 %c, label %is_null, label %not_null
64 %t = load i32, i32* %x
69 ; CHECK-LABEL: __LLVM_FaultMaps:
76 ; CHECK-NEXT: .short 0
82 ; CHECK-NEXT: .quad _imp_null_check_add_result
89 ; Fault[0].FaultOffset:
90 ; CHECK-NEXT: .long Ltmp5-_imp_null_check_add_result
91 ; Fault[0].HandlerOffset:
92 ; CHECK-NEXT: .long Ltmp4-_imp_null_check_add_result
95 ; CHECK-NEXT: .quad _imp_null_check_gep_load
101 ; CHECK-NEXT: .long 1
102 ; Fault[0].FaultOffset:
103 ; CHECK-NEXT: .long Ltmp3-_imp_null_check_gep_load
104 ; Fault[0].HandlerOffset:
105 ; CHECK-NEXT: .long Ltmp2-_imp_null_check_gep_load
108 ; CHECK-NEXT: .quad _imp_null_check_load
110 ; CHECK-NEXT: .long 1
112 ; CHECK-NEXT: .long 0
114 ; CHECK-NEXT: .long 1
115 ; Fault[0].FaultOffset:
116 ; CHECK-NEXT: .long Ltmp1-_imp_null_check_load
117 ; Fault[0].HandlerOffset:
118 ; CHECK-NEXT: .long Ltmp0-_imp_null_check_load