| # RUN: llc -run-pass=implicit-null-checks -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s | |
| # RUN: llc -passes=implicit-null-checks -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s | |
| # Pseudo probes have no execution semantics but are marked as having side | |
| # effects, so they used to make the null check analysis give up. They must be | |
| # ignored by the scan and must stay in the non-null successor. | |
| --- | | |
| target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | |
| target triple = "x86_64-unknown-linux-gnu" | |
| define i32 @imp_null_check_with_pseudo_probe(ptr %x, i1 %arg) { | |
| entry: | |
| br i1 %arg, label %is_null, label %not_null, !make.implicit !0 | |
| not_null: | |
| %value = load i32, ptr %x | |
| ret i32 %value | |
| is_null: | |
| ret i32 42 | |
| } | |
| !0 = !{i32 1} | |
| ... | |
| --- | |
| name: imp_null_check_with_pseudo_probe | |
| alignment: 16 | |
| liveins: | |
| - { reg: '$rdi' } | |
| # CHECK-LABEL: name: imp_null_check_with_pseudo_probe | |
| # CHECK: bb.0.entry: | |
| # CHECK: $eax = FAULTING_OP 1, %bb.2, {{[0-9]+}}, $rdi, 1, $noreg, 0, $noreg :: (load (s32) from %ir.x) | |
| # CHECK-NEXT: JMP_1 %bb.1 | |
| # CHECK: bb.1.not_null: | |
| # CHECK: PSEUDO_PROBE 0, 1, 0, 0 | |
| # CHECK-NEXT: RET64 $eax | |
| body: | | |
| bb.0.entry: | |
| liveins: $rdi | |
| TEST64rr $rdi, $rdi, implicit-def $eflags | |
| JCC_1 %bb.2, 4, implicit $eflags | |
| bb.1.not_null: | |
| liveins: $rdi | |
| PSEUDO_PROBE 0, 1, 0, 0 | |
| $eax = MOV32rm killed $rdi, 1, $noreg, 0, $noreg :: (load (s32) from %ir.x) | |
| RET64 $eax | |
| bb.2.is_null: | |
| $eax = MOV32ri 42 | |
| RET64 $eax | |
| ... |