1; RUN: llc -mtriple=x86_64-apple-macosx -O3 -debug-only=faultmaps -enable-implicit-null-checks < %s | FileCheck %s 2 3; List cases where we should *not* be emitting implicit null checks. 4 5; CHECK-NOT: Fault Map Output 6 7define i32 @imp_null_check_load(i32* %x, i32* %y) { 8 entry: 9 %c = icmp eq i32* %x, null 10; It isn't legal to move the load from %x from "not_null" to here -- 11; the store to %y could be aliasing it. 12 br i1 %c, label %is_null, label %not_null 13 14 is_null: 15 ret i32 42 16 17 not_null: 18 store i32 0, i32* %y 19 %t = load i32, i32* %x 20 ret i32 %t 21} 22 23define i32 @imp_null_check_gep_load(i32* %x) { 24 entry: 25 %c = icmp eq i32* %x, null 26 br i1 %c, label %is_null, label %not_null 27 28 is_null: 29 ret i32 42 30 31 not_null: 32; null + 5000 * sizeof(i32) lies outside the null page and hence the 33; load to %t cannot be assumed to be reliably faulting. 34 %x.gep = getelementptr i32, i32* %x, i32 5000 35 %t = load i32, i32* %x.gep 36 ret i32 %t 37} 38 39define i32 @imp_null_check_load_no_md(i32* %x) { 40; Everything is okay except that the !never.executed metadata is 41; missing. 42 entry: 43 %c = icmp eq i32* %x, null 44 br i1 %c, label %is_null, label %not_null 45 46 is_null: 47 ret i32 42 48 49 not_null: 50 %t = load i32, i32* %x 51 ret i32 %t 52} 53