Home | History | Annotate | Download | only in X86
      1 # RUN: llc -mtriple=x86_64 -run-pass=implicit-null-checks %s -o - | FileCheck %s
      2 --- |
      3 
      4   define i32 @reg-rewrite(i32* %x) {
      5   entry:
      6     br i1 undef, label %is_null, label %not_null, !make.implicit !0
      7 
      8   is_null:
      9     ret i32 42
     10 
     11   not_null:
     12     ret i32 100
     13   }
     14 
     15   !0 = !{}
     16 
     17 ...
     18 ---
     19 # Check that the TEST instruction is replaced with 
     20 # FAULTING_OP only if there are no instructions
     21 # between the TEST and conditional jump
     22 # that clobber the register used in TEST.
     23 name:            reg-rewrite
     24 
     25 alignment:       4
     26 tracksRegLiveness: true
     27 liveins:
     28   - { reg: '$rdi' }
     29 
     30 body:             |
     31   bb.0.entry:
     32     liveins: $rdi
     33 
     34     TEST64rr $rdi, $rdi, implicit-def $eflags
     35     ; CHECK-LABEL: bb.0.entry
     36     ; CHECK-NOT: FAULTING_OP
     37     renamable $rdi = MOV64ri 5000
     38     JE_1 %bb.2, implicit $eflags
     39 
     40   bb.1.not_null:
     41     liveins: $rdi, $rsi
     42     
     43     $rax = MOV64rm renamable $rdi, 1, $noreg, 4, $noreg
     44     RETQ $eax
     45 
     46   bb.2.is_null:
     47     $eax = MOV32ri 200
     48     RETQ $eax
     49 ...
     50