|
| 1 | +# RUN: llc -mtriple=aarch64-apple-ios -run-pass=early-tailduplication %s -o - | FileCheck %s |
| 2 | + |
| 3 | +--- | |
| 4 | + ; ModuleID = 'taildup.ll' |
| 5 | + source_filename = "taildup.ll" |
| 6 | + target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" |
| 7 | + target triple = "aarch64-apple-ios" |
| 8 | + |
| 9 | + @bb1 = global i8* blockaddress(@foo, %final) |
| 10 | + @bb2 = global i8* inttoptr (i32 1 to i8*) |
| 11 | + |
| 12 | + define void @foo(i1 %tst, i32* %ptr) { |
| 13 | + br i1 %tst, label %left, label %right |
| 14 | + |
| 15 | + left: ; preds = %0 |
| 16 | + %val.left = call i32 @bar() |
| 17 | + br label %next |
| 18 | + |
| 19 | + right: ; preds = %0 |
| 20 | + %val.right = call i32 @baz() |
| 21 | + br label %next |
| 22 | + |
| 23 | + next: ; preds = %right, %left |
| 24 | + %val = phi i32 [ %val.left, %left ], [ %val.right, %right ] |
| 25 | + store i32 %val, i32* %ptr, align 4 |
| 26 | + br label %final |
| 27 | + |
| 28 | + final: ; preds = %next |
| 29 | + %1 = call i32 @bar() |
| 30 | + ret void |
| 31 | + } |
| 32 | + |
| 33 | + declare i32 @bar() |
| 34 | + |
| 35 | + declare i32 @baz() |
| 36 | + |
| 37 | +... |
| 38 | +--- |
| 39 | +name: foo |
| 40 | +alignment: 4 |
| 41 | +exposesReturnsTwice: false |
| 42 | +legalized: false |
| 43 | +regBankSelected: false |
| 44 | +selected: false |
| 45 | +failedISel: false |
| 46 | +tracksRegLiveness: true |
| 47 | +hasWinCFI: false |
| 48 | +registers: |
| 49 | + - { id: 0, class: gpr32all, preferred-register: '' } |
| 50 | + - { id: 1, class: gpr32all, preferred-register: '' } |
| 51 | + - { id: 2, class: gpr32, preferred-register: '' } |
| 52 | + - { id: 3, class: gpr32, preferred-register: '' } |
| 53 | + - { id: 4, class: gpr64common, preferred-register: '' } |
| 54 | + - { id: 5, class: gpr32all, preferred-register: '' } |
| 55 | + - { id: 6, class: gpr32all, preferred-register: '' } |
| 56 | + - { id: 7, class: gpr32all, preferred-register: '' } |
| 57 | +liveins: |
| 58 | + - { reg: '$w0', virtual-reg: '%3' } |
| 59 | + - { reg: '$x1', virtual-reg: '%4' } |
| 60 | +frameInfo: |
| 61 | + isFrameAddressTaken: false |
| 62 | + isReturnAddressTaken: false |
| 63 | + hasStackMap: false |
| 64 | + hasPatchPoint: false |
| 65 | + stackSize: 0 |
| 66 | + offsetAdjustment: 0 |
| 67 | + maxAlignment: 1 |
| 68 | + adjustsStack: true |
| 69 | + hasCalls: true |
| 70 | + stackProtector: '' |
| 71 | + maxCallFrameSize: 0 |
| 72 | + cvBytesOfCalleeSavedRegisters: 0 |
| 73 | + hasOpaqueSPAdjustment: false |
| 74 | + hasVAStart: false |
| 75 | + hasMustTailInVarArgFunc: false |
| 76 | + hasTailCall: false |
| 77 | + localFrameSize: 0 |
| 78 | + savePoint: '' |
| 79 | + restorePoint: '' |
| 80 | +fixedStack: [] |
| 81 | +stack: [] |
| 82 | +callSites: [] |
| 83 | +debugValueSubstitutions: [] |
| 84 | +constants: [] |
| 85 | +machineFunctionInfo: {} |
| 86 | +body: | |
| 87 | + bb.0 (%ir-block.0): |
| 88 | + successors: %bb.1(0x40000000), %bb.2(0x40000000) |
| 89 | + liveins: $w0, $x1 |
| 90 | +
|
| 91 | + %4:gpr64common = COPY $x1 |
| 92 | + %3:gpr32 = COPY $w0 |
| 93 | + TBZW %3, 0, %bb.2 |
| 94 | + B %bb.1 |
| 95 | +
|
| 96 | + bb.1.left: |
| 97 | + successors: %bb.3(0x80000000) |
| 98 | +
|
| 99 | + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp |
| 100 | + BL @bar, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0 |
| 101 | + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp |
| 102 | + %6:gpr32all = COPY $w0 |
| 103 | + %0:gpr32all = COPY %6 |
| 104 | + B %bb.3 |
| 105 | +
|
| 106 | + bb.2.right: |
| 107 | + successors: %bb.3(0x80000000) |
| 108 | +
|
| 109 | + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp |
| 110 | + BL @baz, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0 |
| 111 | + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp |
| 112 | + %5:gpr32all = COPY $w0 |
| 113 | + %1:gpr32all = COPY %5 |
| 114 | +
|
| 115 | + bb.3.next: |
| 116 | + successors: %bb.4(0x80000000) |
| 117 | +
|
| 118 | + ; CHECK: %2:gpr32 = PHI |
| 119 | + %2:gpr32 = PHI %1, %bb.2, %0, %bb.1 |
| 120 | + STRWui %2, %4, 0 :: (store (s32) into %ir.ptr) |
| 121 | +
|
| 122 | + bb.4.final (ir-block-address-taken %ir-block.final): |
| 123 | + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp |
| 124 | + BL @bar, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $w0 |
| 125 | + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp |
| 126 | + %7:gpr32all = COPY $w0 |
| 127 | + RET_ReallyLR |
| 128 | +
|
| 129 | +... |
0 commit comments