1 ; RUN: llc -mtriple=x86_64-apple-macosx -O3 -debug-only=faultmaps -enable-implicit-null-checks < %s | FileCheck %s
4 ; List cases where we should *not* be emitting implicit null checks.
6 ; CHECK-NOT: Fault Map Output
8 define i32 @imp_null_check_load(i32* %x, i32* %y) {
10 %c = icmp eq i32* %x, null
11 ; It isn't legal to move the load from %x from "not_null" to here --
12 ; the store to %y could be aliasing it.
13 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) {
26 %c = icmp eq i32* %x, null
27 br i1 %c, label %is_null, label %not_null
33 ; null + 5000 * sizeof(i32) lies outside the null page and hence the
34 ; load to %t cannot be assumed to be reliably faulting.
35 %x.gep = getelementptr i32, i32* %x, i32 5000
36 %t = load i32, i32* %x.gep
40 define i32 @imp_null_check_load_no_md(i32* %x) {
41 ; Everything is okay except that the !never.executed metadata is
44 %c = icmp eq i32* %x, null
45 br i1 %c, label %is_null, label %not_null
51 %t = load i32, i32* %x