1 ; RUN: llc -mtriple=x86_64-apple-macosx -O3 -debug-only=faultmaps -enable-implicit-null-checks < %s | FileCheck %s
3 ; List cases where we should *not* be emitting implicit null checks.
5 ; CHECK-NOT: Fault Map Output
7 define i32 @imp_null_check_load(i32* %x, i32* %y) {
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
19 %t = load i32, i32* %x
23 define i32 @imp_null_check_gep_load(i32* %x) {
25 %c = icmp eq i32* %x, null
26 br i1 %c, label %is_null, label %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
39 define i32 @imp_null_check_load_no_md(i32* %x) {
40 ; Everything is okay except that the !never.executed metadata is
43 %c = icmp eq i32* %x, null
44 br i1 %c, label %is_null, label %not_null
50 %t = load i32, i32* %x