1# RUN: llc -mtriple=aarch64-unknown-unknown -o - -verify-machineinstrs -run-pass=instruction-select %s | FileCheck %s 2--- | 3 ; ModuleID = '/tmp/test.ll' 4 source_filename = "/tmp/test.ll" 5 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 6 target triple = "aarch64-unknown-unknown" 7 8 define i32 @test_phi(i32 %argc) { 9 entry: 10 %cmp = icmp ugt i32 %argc, 0 11 br i1 %cmp, label %case1, label %case2 12 13 case1: ; preds = %entry 14 %tmp1 = add i32 %argc, 1 15 br label %return 16 17 case2: ; preds = %entry 18 %tmp2 = add i32 %argc, 2 19 br label %return 20 21 return: ; preds = %case2, %case1 22 %res = phi i32 [ %tmp1, %case1 ], [ %tmp2, %case2 ] 23 ret i32 %res 24 } 25 26 define i64* @test_phi_ptr(i64* %a, i64* %b, i1 %cond) { 27 entry: 28 ret i64* null 29 } 30 31... 32--- 33name: test_phi 34alignment: 2 35exposesReturnsTwice: false 36legalized: true 37regBankSelected: true 38selected: false 39tracksRegLiveness: true 40registers: 41 - { id: 0, class: gpr, preferred-register: '' } 42 - { id: 1, class: gpr, preferred-register: '' } 43 - { id: 2, class: gpr, preferred-register: '' } 44 - { id: 3, class: gpr, preferred-register: '' } 45 - { id: 4, class: gpr, preferred-register: '' } 46 - { id: 5, class: gpr, preferred-register: '' } 47 - { id: 6, class: gpr, preferred-register: '' } 48 - { id: 7, class: gpr, preferred-register: '' } 49 - { id: 8, class: gpr, preferred-register: '' } 50liveins: 51body: | 52 bb.1.entry: 53 successors: %bb.2.case1(0x40000000), %bb.3.case2(0x40000000) 54 liveins: $w0 55 ; CHECK-LABEL: name: test_phi 56 ; CHECK: [[RES:%.*]]:gpr32 = PHI 57 58 %0(s32) = COPY $w0 59 %1(s32) = G_CONSTANT i32 0 60 %3(s32) = G_CONSTANT i32 1 61 %5(s32) = G_CONSTANT i32 2 62 %8(s32) = G_ICMP intpred(ugt), %0(s32), %1 63 %2(s1) = G_TRUNC %8(s32) 64 G_BRCOND %2(s1), %bb.2.case1 65 G_BR %bb.3.case2 66 67 bb.2.case1: 68 successors: %bb.4.return(0x80000000) 69 70 %4(s32) = G_ADD %0, %3 71 G_BR %bb.4.return 72 73 bb.3.case2: 74 successors: %bb.4.return(0x80000000) 75 76 %6(s32) = G_ADD %0, %5 77 78 bb.4.return: 79 %7(s32) = G_PHI %4(s32), %bb.2.case1, %6(s32), %bb.3.case2 80 $w0 = COPY %7(s32) 81 RET_ReallyLR implicit $w0 82 83... 84 85--- 86name: test_phi_ptr 87alignment: 2 88exposesReturnsTwice: false 89legalized: true 90regBankSelected: true 91selected: false 92tracksRegLiveness: true 93registers: 94 - { id: 0, class: gpr, preferred-register: '' } 95 - { id: 1, class: gpr, preferred-register: '' } 96 - { id: 2, class: gpr, preferred-register: '' } 97 - { id: 3, class: gpr, preferred-register: '' } 98 - { id: 4, class: _, preferred-register: '' } 99 - { id: 5, class: _, preferred-register: '' } 100liveins: 101body: | 102 bb.0: 103 successors: %bb.1, %bb.2 104 liveins: $w2, $x0, $x1 105 ; CHECK-LABEL: name: test_phi_ptr 106 107 %0(p0) = COPY $x0 108 %1(p0) = COPY $x1 109 %6:gpr(s32) = COPY $w2 110 %2(s1) = G_TRUNC %6 111 G_BRCOND %2(s1), %bb.1 112 G_BR %bb.2 113 114 bb.1: 115 successors: %bb.2 116 117 118 bb.2: 119 ; CHECK: %{{[0-9]+}}:gpr64 = PHI %{{[0-9]+}}, %bb.0, %{{[0-9]+}}, %bb.1 120 %3(p0) = G_PHI %0(p0), %bb.0, %1(p0), %bb.1 121 $x0 = COPY %3(p0) 122 RET_ReallyLR implicit $x0 123 124... 125