reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
# RUN: llc -mtriple=aarch64-unknown-unknown -o - -verify-machineinstrs -run-pass=instruction-select %s | FileCheck %s
--- |
  ; ModuleID = '/tmp/test.ll'
  source_filename = "/tmp/test.ll"
  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
  target triple = "aarch64-unknown-unknown"

  define i32 @test_phi(i32 %argc) {
  entry:
    %cmp = icmp ugt i32 %argc, 0
    br i1 %cmp, label %case1, label %case2

  case1:                                            ; preds = %entry
    %tmp1 = add i32 %argc, 1
    br label %return

  case2:                                            ; preds = %entry
    %tmp2 = add i32 %argc, 2
    br label %return

  return:                                           ; preds = %case2, %case1
    %res = phi i32 [ %tmp1, %case1 ], [ %tmp2, %case2 ]
    ret i32 %res
  }

  define i64* @test_phi_ptr(i64* %a, i64* %b, i1 %cond) {
  entry:
    ret i64* null
  }

...
---
name:            test_phi
alignment:       4
exposesReturnsTwice: false
legalized:       true
regBankSelected: true
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: gpr, preferred-register: '' }
  - { id: 1, class: gpr, preferred-register: '' }
  - { id: 2, class: gpr, preferred-register: '' }
  - { id: 3, class: gpr, preferred-register: '' }
  - { id: 4, class: gpr, preferred-register: '' }
  - { id: 5, class: gpr, preferred-register: '' }
  - { id: 6, class: gpr, preferred-register: '' }
  - { id: 7, class: gpr, preferred-register: '' }
  - { id: 8, class: gpr, preferred-register: '' }
liveins:
body:             |
  bb.1.entry:
    successors: %bb.2.case1(0x40000000), %bb.3.case2(0x40000000)
    liveins: $w0
    ; CHECK-LABEL: name: test_phi
    ; CHECK: [[RES:%.*]]:gpr32 = PHI

    %0(s32) = COPY $w0
    %1(s32) = G_CONSTANT i32 0
    %3(s32) = G_CONSTANT i32 1
    %5(s32) = G_CONSTANT i32 2
    %8(s32) = G_ICMP intpred(ugt), %0(s32), %1
    %2(s1) = G_TRUNC %8(s32)
    G_BRCOND %2(s1), %bb.2.case1
    G_BR %bb.3.case2

  bb.2.case1:
    successors: %bb.4.return(0x80000000)

    %4(s32) = G_ADD %0, %3
    G_BR %bb.4.return

  bb.3.case2:
    successors: %bb.4.return(0x80000000)

    %6(s32) = G_ADD %0, %5

  bb.4.return:
    %7(s32) = G_PHI %4(s32), %bb.2.case1, %6(s32), %bb.3.case2
    $w0 = COPY %7(s32)
    RET_ReallyLR implicit $w0

...

---
name:            test_phi_ptr
alignment:       4
exposesReturnsTwice: false
legalized:       true
regBankSelected: true
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: gpr, preferred-register: '' }
  - { id: 1, class: gpr, preferred-register: '' }
  - { id: 2, class: gpr, preferred-register: '' }
  - { id: 3, class: gpr, preferred-register: '' }
  - { id: 4, class: _, preferred-register: '' }
  - { id: 5, class: _, preferred-register: '' }
liveins:
body:             |
  bb.0:
    successors: %bb.1, %bb.2
    liveins: $w2, $x0, $x1
    ; CHECK-LABEL: name: test_phi_ptr

    %0(p0) = COPY $x0
    %1(p0) = COPY $x1
    %6:gpr(s32) = COPY $w2
    %2(s1) = G_TRUNC %6
    G_BRCOND %2(s1), %bb.1
    G_BR %bb.2

  bb.1:
    successors: %bb.2


  bb.2:
    ; CHECK: %{{[0-9]+}}:gpr64 = PHI %{{[0-9]+}}, %bb.0, %{{[0-9]+}}, %bb.1
    %3(p0) = G_PHI %0(p0), %bb.0, %1(p0), %bb.1
    $x0 = COPY %3(p0)
    RET_ReallyLR implicit $x0

...