105 lines · plain
1; RUN: llc -verify-machineinstrs -O3 -mtriple=x86_64-apple-macosx -enable-implicit-null-checks < %s | FileCheck %s2 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 OBJDUMP7 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 OBJDUMP12 13;; The tests in this file exist just to check basic validity of the FaultMap14;; section. Please don't add to this file unless you're testing the FaultMap15;; serialization code itself.16 17define i32 @imp_null_check_load(ptr %x) {18; CHECK-LABEL: _imp_null_check_load:19; CHECK: [[BB0_imp_null_check_load:L[^:]+]]:20; CHECK: movl (%rdi), %eax21; CHECK: retq22; CHECK: [[BB1_imp_null_check_load:LBB0_[0-9]+]]:23; CHECK: movl $42, %eax24; CHECK: retq25 26 entry:27 %c = icmp eq ptr %x, null28 br i1 %c, label %is_null, label %not_null, !make.implicit !029 30 is_null:31 ret i32 4232 33 not_null:34 %t = load i32, ptr %x35 ret i32 %t36}37 38define void @imp_null_check_store(ptr %x) {39; CHECK-LABEL: _imp_null_check_store:40; CHECK: [[BB0_imp_null_check_store:L[^:]+]]:41; CHECK: movl $1, (%rdi)42; CHECK: retq43; CHECK: [[BB1_imp_null_check_store:LBB1_[0-9]+]]:44; CHECK: retq45 46 entry:47 %c = icmp eq ptr %x, null48 br i1 %c, label %is_null, label %not_null, !make.implicit !049 50 is_null:51 ret void52 53 not_null:54 store i32 1, ptr %x55 ret void56}57 58!0 = !{}59 60; CHECK-LABEL: __LLVM_FaultMaps:61 62; Version:63; CHECK-NEXT: .byte 164 65; Reserved x266; CHECK-NEXT: .byte 067; CHECK-NEXT: .short 068 69; # functions:70; CHECK-NEXT: .long 271 72; FunctionAddr:73; CHECK-NEXT: .quad _imp_null_check_load74; NumFaultingPCs75; CHECK-NEXT: .long 176; Reserved:77; CHECK-NEXT: .long 078; Fault[0].Type:79; CHECK-NEXT: .long 180; Fault[0].FaultOffset:81; CHECK-NEXT: .long [[BB0_imp_null_check_load]]-_imp_null_check_load82; Fault[0].HandlerOffset:83; CHECK-NEXT: .long [[BB1_imp_null_check_load]]-_imp_null_check_load84 85; FunctionAddr:86; CHECK-NEXT: .quad _imp_null_check_store87; NumFaultingPCs88; CHECK-NEXT: .long 189; Reserved:90; CHECK-NEXT: .long 091; Fault[0].Type:92; CHECK-NEXT: .long 393; Fault[0].FaultOffset:94; CHECK-NEXT: .long [[BB0_imp_null_check_store]]-_imp_null_check_store95; Fault[0].HandlerOffset:96; CHECK-NEXT: .long [[BB1_imp_null_check_store]]-_imp_null_check_store97 98; OBJDUMP: FaultMap table:99; OBJDUMP-NEXT: Version: 0x1100; OBJDUMP-NEXT: NumFunctions: 2101; OBJDUMP-NEXT: FunctionAddress: 0x000000, NumFaultingPCs: 1102; OBJDUMP-NEXT: Fault kind: FaultingLoad, faulting PC offset: 0, handling PC offset: 3103; OBJDUMP-NEXT: FunctionAddress: 0x000000, NumFaultingPCs: 1104; OBJDUMP-NEXT: Fault kind: FaultingStore, faulting PC offset: 0, handling PC offset: 7105