Home | History | Annotate | Download | only in AArch64
      1 # RUN: llc %s -run-pass greedy -o - | FileCheck %s
      2 # Check that we don't insert spill code for undef values.
      3 # Uninitialized memory for them is fine.
      4 # PR33311
      5 --- |
      6   ; ModuleID = 'stuff.ll'
      7   target triple = "aarch64--"
      8 
      9   @g = external global i32
     10 
     11   define void @foobar() {
     12     ret void
     13   }
     14 
     15 ...
     16 ---
     17 name:            foobar
     18 alignment:       2
     19 tracksRegLiveness: true
     20 registers:
     21   - { id: 0, class: gpr32 }
     22   - { id: 1, class: gpr32 }
     23   - { id: 2, class: gpr32all }
     24   - { id: 3, class: gpr32 }
     25   - { id: 4, class: gpr64common }
     26   - { id: 5, class: gpr32 }
     27   - { id: 6, class: gpr64common }
     28   - { id: 7, class: gpr32 }
     29   - { id: 8, class: gpr32 }
     30   - { id: 9, class: gpr64 }
     31 body:             |
     32   bb.0:
     33     liveins: $x0
     34     successors: %bb.1, %bb.2
     35 
     36     ; %8 is going to be spilled.
     37     ; But on that path, we don't care about its value.
     38     ; Emit a simple KILL instruction instead of an
     39     ; actual spill.
     40     ; CHECK: [[UNDEF:%[0-9]+]]:gpr32 = IMPLICIT_DEF
     41     ; CHECK-NEXT: KILL [[UNDEF]]
     42     %8 = IMPLICIT_DEF
     43     ; %9 us going to be spilled.
     44     ; But it is only partially undef.
     45     ; Make sure we spill it properly
     46     ; CHECK: [[NINE:%[0-9]+]]:gpr64 = COPY $x0
     47     ; CHECK: [[NINE]].sub_32:gpr64 = IMPLICIT_DEF
     48     ; CHECK-NEXT: STRXui [[NINE]]
     49     %9 = COPY $x0
     50     %9.sub_32 = IMPLICIT_DEF
     51     CBNZW $wzr, %bb.2
     52     B %bb.1
     53 
     54   bb.1:
     55     %4 = ADRP target-flags(aarch64-page) @g
     56     %8 = LDRWui %4, target-flags(aarch64-pageoff, aarch64-nc) @g :: (volatile dereferenceable load 4 from @g)
     57     INLINEASM &nop, 1, 12, implicit-def dead early-clobber $x0, 12, implicit-def dead early-clobber $x1, 12, implicit-def dead early-clobber $x2, 12, implicit-def dead early-clobber $x3, 12, implicit-def dead early-clobber $x4, 12, implicit-def dead early-clobber $x5, 12, implicit-def dead early-clobber $x6, 12, implicit-def dead early-clobber $x7, 12, implicit-def dead early-clobber $x8, 12, implicit-def dead early-clobber $x9, 12, implicit-def dead early-clobber $x10, 12, implicit-def dead early-clobber $x11, 12, implicit-def dead early-clobber $x12, 12, implicit-def dead early-clobber $x13, 12, implicit-def dead early-clobber $x14, 12, implicit-def dead early-clobber $x15, 12, implicit-def dead early-clobber $x16, 12, implicit-def dead early-clobber $x17, 12, implicit-def dead early-clobber $x18, 12, implicit-def dead early-clobber $x19, 12, implicit-def dead early-clobber $x20, 12, implicit-def dead early-clobber $x21, 12, implicit-def dead early-clobber $x22, 12, implicit-def dead early-clobber $x23, 12, implicit-def dead early-clobber $x24, 12, implicit-def dead early-clobber $x25, 12, implicit-def dead early-clobber $x26, 12, implicit-def dead early-clobber $x27, 12, implicit-def dead early-clobber $x28, 12, implicit-def dead early-clobber $fp, 12, implicit-def dead early-clobber $lr
     58 
     59   bb.2:
     60     INLINEASM &nop, 1, 12, implicit-def dead early-clobber $x0, 12, implicit-def dead early-clobber $x1, 12, implicit-def dead early-clobber $x2, 12, implicit-def dead early-clobber $x3, 12, implicit-def dead early-clobber $x4, 12, implicit-def dead early-clobber $x5, 12, implicit-def dead early-clobber $x6, 12, implicit-def dead early-clobber $x7, 12, implicit-def dead early-clobber $x8, 12, implicit-def dead early-clobber $x9, 12, implicit-def dead early-clobber $x10, 12, implicit-def dead early-clobber $x11, 12, implicit-def dead early-clobber $x12, 12, implicit-def dead early-clobber $x13, 12, implicit-def dead early-clobber $x14, 12, implicit-def dead early-clobber $x15, 12, implicit-def dead early-clobber $x16, 12, implicit-def dead early-clobber $x17, 12, implicit-def dead early-clobber $x18, 12, implicit-def dead early-clobber $x19, 12, implicit-def dead early-clobber $x20, 12, implicit-def dead early-clobber $x21, 12, implicit-def dead early-clobber $x22, 12, implicit-def dead early-clobber $x23, 12, implicit-def dead early-clobber $x24, 12, implicit-def dead early-clobber $x25, 12, implicit-def dead early-clobber $x26, 12, implicit-def dead early-clobber $x27, 12, implicit-def dead early-clobber $x28, 12, implicit-def dead early-clobber $fp, 12, implicit-def dead early-clobber $lr
     61     %6 = ADRP target-flags(aarch64-page) @g
     62     $w0 = MOVi32imm 42
     63     STRWui %8, %6, target-flags(aarch64-pageoff, aarch64-nc) @g :: (volatile store 4 into @g)
     64     STRXui %9, %6, target-flags(aarch64-pageoff, aarch64-nc) @g :: (volatile store 8 into @g)
     65     RET_ReallyLR implicit killed $w0
     66 
     67 ...
     68