From: Sanjoy Das Date: Thu, 26 Jan 2017 01:07:33 +0000 (+0000) Subject: [ImplicitNullChecks] Add a test demonstrating a case we don't get today X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93716868f3d50f920b2c0cb213fd64a1e977d700;p=llvm [ImplicitNullChecks] Add a test demonstrating a case we don't get today git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293126 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/implicit-null-checks.mir b/test/CodeGen/X86/implicit-null-checks.mir index 81351511374..d2a9e5e50a2 100644 --- a/test/CodeGen/X86/implicit-null-checks.mir +++ b/test/CodeGen/X86/implicit-null-checks.mir @@ -131,6 +131,18 @@ ret i32 0 } + define i32 @use_alternate_load_op(i32* %ptr, i32* %ptr2) { + entry: + %ptr_is_null = icmp eq i32* %ptr, null + br i1 %ptr_is_null, label %is_null, label %not_null, !make.implicit !0 + + not_null: + ret i32 undef + + is_null: + ret i32 0 + } + attributes #0 = { "target-features"="+bmi,+bmi2" } !0 = !{} @@ -431,3 +443,37 @@ body: | RETQ %eax ... +--- +name: use_alternate_load_op +# CHECK-LABEL: use_alternate_load_op +# CHECK: bb.0.entry: +# CHECK: TEST64rr %rdi, %rdi, implicit-def %eflags +# CHECK-NEXT: JE_1 %bb.2.is_null, implicit killed %eflags +# CHECK: bb.1.not_null + +alignment: 4 +tracksRegLiveness: true +liveins: + - { reg: '%rdi' } + - { reg: '%rsi' } +body: | + bb.0.entry: + successors: %bb.2.is_null, %bb.1.not_null + liveins: %rdi, %rsi + + TEST64rr %rdi, %rdi, implicit-def %eflags + JE_1 %bb.2.is_null, implicit killed %eflags + + bb.1.not_null: + liveins: %rdi, %rsi + + %rcx = MOV64rm killed %rsi, 1, _, 0, _ + %rdx = AND64rm killed %rcx, %rdi, 1, _, 0, _, implicit-def dead %eflags + %r10 = MOV64rm killed %rdi, 1, _, 0, _ + RETQ %r10d + + bb.2.is_null: + %eax = XOR32rr undef %eax, undef %eax, implicit-def dead %eflags + RETQ %eax + +...