1 ; RUN: llc -verify-machineinstrs -O3 -mtriple=x86_64-apple-macosx -enable-implicit-null-checks < %s | FileCheck %s
3 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -enable-implicit-null-checks \
4 ; RUN: | llvm-mc -triple x86_64-apple-macosx -filetype=obj -o - \
5 ; RUN: | llvm-objdump -triple x86_64-apple-macosx -fault-map-section - \
6 ; RUN: | FileCheck %s -check-prefix OBJDUMP
8 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -enable-implicit-null-checks \
9 ; RUN: | llvm-mc -triple x86_64-unknown-linux-gnu -filetype=obj -o - \
10 ; RUN: | llvm-objdump -triple x86_64-unknown-linux-gnu -fault-map-section - \
11 ; RUN: | FileCheck %s -check-prefix OBJDUMP
13 ;; The tests in this file exist just to check basic validity of the FaultMap
14 ;; section. Please don't add to this file unless you're testing the FaultMap
15 ;; serialization code itself.
17 define i32 @imp_null_check_load(i32* %x) {
18 ; CHECK-LABEL: _imp_null_check_load:
19 ; CHECK: [[BB0_imp_null_check_load:L[^:]+]]:
20 ; CHECK: movl (%rdi), %eax
22 ; CHECK: [[BB1_imp_null_check_load:LBB0_[0-9]+]]:
23 ; CHECK: movl $42, %eax
27 %c = icmp eq i32* %x, null
28 br i1 %c, label %is_null, label %not_null, !make.implicit !0
34 %t = load i32, i32* %x
38 define void @imp_null_check_store(i32* %x) {
39 ; CHECK-LABEL: _imp_null_check_store:
40 ; CHECK: [[BB0_imp_null_check_store:L[^:]+]]:
41 ; CHECK: movl $1, (%rdi)
43 ; CHECK: [[BB1_imp_null_check_store:LBB1_[0-9]+]]:
47 %c = icmp eq i32* %x, null
48 br i1 %c, label %is_null, label %not_null, !make.implicit !0
60 ; CHECK-LABEL: __LLVM_FaultMaps:
67 ; CHECK-NEXT: .short 0
73 ; CHECK-NEXT: .quad _imp_null_check_load
80 ; Fault[0].FaultOffset:
81 ; CHECK-NEXT: .long [[BB0_imp_null_check_load]]-_imp_null_check_load
82 ; Fault[0].HandlerOffset:
83 ; CHECK-NEXT: .long [[BB1_imp_null_check_load]]-_imp_null_check_load
86 ; CHECK-NEXT: .quad _imp_null_check_store
93 ; Fault[0].FaultOffset:
94 ; CHECK-NEXT: .long [[BB0_imp_null_check_store]]-_imp_null_check_store
95 ; Fault[0].HandlerOffset:
96 ; CHECK-NEXT: .long [[BB1_imp_null_check_store]]-_imp_null_check_store
98 ; OBJDUMP: FaultMap table:
99 ; OBJDUMP-NEXT: Version: 0x1
100 ; OBJDUMP-NEXT: NumFunctions: 2
101 ; OBJDUMP-NEXT: FunctionAddress: 0x000000, NumFaultingPCs: 1
102 ; OBJDUMP-NEXT: Fault kind: FaultingLoad, faulting PC offset: 0, handling PC offset: 3
103 ; OBJDUMP-NEXT: FunctionAddress: 0x000000, NumFaultingPCs: 1
104 ; OBJDUMP-NEXT: Fault kind: FaultingStore, faulting PC offset: 0, handling PC offset: 7