Home | History | Annotate | Download | only in X86
      1 # RUN: llc -march=x86-64 -enable-shrink-wrap=true -start-after shrink-wrap -stop-after shrink-wrap -o /dev/null %s | FileCheck %s
      2 # This test ensures that the MIR parser parses the save and restore points in
      3 # the machine frame info correctly.
      4 
      5 --- |
      6 
      7   define i32 @foo(i32 %a, i32 %b) {
      8   entry:
      9     %tmp = alloca i32, align 4
     10     %tmp2 = icmp slt i32 %a, %b
     11     br i1 %tmp2, label %true, label %false
     12 
     13   true:
     14     store i32 %a, i32* %tmp, align 4
     15     %tmp4 = call i32 @doSomething(i32 0, i32* %tmp)
     16     br label %false
     17 
     18   false:
     19     %tmp.0 = phi i32 [ %tmp4, %true ], [ %a, %entry ]
     20     ret i32 %tmp.0
     21   }
     22 
     23   declare i32 @doSomething(i32, i32*)
     24 
     25 ...
     26 ---
     27 name:            foo
     28 tracksRegLiveness: true
     29 liveins:
     30   - { reg: '%edi' }
     31   - { reg: '%esi' }
     32 # CHECK: frameInfo:
     33 # CHECK:      savePoint: '%bb.2.true'
     34 # CHECK-NEXT: restorePoint: '%bb.2.true'
     35 # CHECK: stack
     36 frameInfo:
     37   maxAlignment:  4
     38   hasCalls:      true
     39   savePoint:     '%bb.2.true'
     40   restorePoint:  '%bb.2.true'
     41 stack:
     42   - { id: 0, name: tmp, offset: 0, size: 4, alignment: 4 }
     43 body: |
     44   bb.0:
     45     successors: %bb.2.true, %bb.1
     46     liveins: %edi, %esi
     47 
     48     %eax = COPY %edi
     49     CMP32rr %eax, killed %esi, implicit-def %eflags
     50     JL_1 %bb.2.true, implicit killed %eflags
     51 
     52   bb.1:
     53     successors: %bb.3.false
     54     liveins: %eax
     55 
     56     JMP_1 %bb.3.false
     57 
     58   bb.2.true:
     59     successors: %bb.3.false
     60     liveins: %eax
     61 
     62     MOV32mr %stack.0.tmp, 1, _, 0, _, killed %eax
     63     ADJCALLSTACKDOWN64 0, 0, implicit-def %rsp, implicit-def dead %eflags, implicit %rsp
     64     %rsi = LEA64r %stack.0.tmp, 1, _, 0, _
     65     %edi = MOV32r0 implicit-def dead %eflags
     66     CALL64pcrel32 @doSomething, csr_64, implicit %rsp, implicit %edi, implicit %rsi, implicit-def %rsp, implicit-def %eax
     67     ADJCALLSTACKUP64 0, 0, implicit-def %rsp, implicit-def dead %eflags, implicit %rsp
     68 
     69   bb.3.false:
     70     liveins: %eax
     71 
     72     RETQ %eax
     73 ...
     74