| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 |
| # RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=tailduplication -tail-dup-pred-size=1 -tail-dup-succ-size=1 %s -o - | FileCheck %s |
| # |
| # Check that only the computed gotos are duplicated aggressively. |
| # |
| --- | |
| @computed_goto.dispatch = constant [5 x ptr] [ptr null, ptr blockaddress(@computed_goto, %bb1), ptr blockaddress(@computed_goto, %bb2), ptr blockaddress(@computed_goto, %bb3), ptr blockaddress(@computed_goto, %bb4)] |
| declare i64 @f0() |
| declare i64 @f1() |
| declare i64 @f2() |
| declare i64 @f3() |
| declare i64 @f4() |
| declare i64 @f5() |
| define void @computed_goto() { |
| start: |
| ret void |
| bb1: |
| ret void |
| bb2: |
| ret void |
| bb3: |
| ret void |
| bb4: |
| ret void |
| } |
| define void @jump_table() { ret void } |
| define void @jump_table_pic() { ret void } |
| ... |
| --- |
| name: computed_goto |
| alignment: 1 |
| exposesReturnsTwice: false |
| legalized: false |
| regBankSelected: false |
| selected: false |
| failedISel: false |
| tracksRegLiveness: true |
| body: | |
| ; CHECK-LABEL: name: computed_goto |
| ; CHECK: bb.0: |
| ; CHECK-NEXT: successors: %bb.1(0x20000000), %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f0, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rax |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64_nosp = COPY [[COPY]] |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr64_nosp = COPY [[COPY1]] |
| ; CHECK-NEXT: JMP64m $noreg, 8, [[COPY2]], @computed_goto.dispatch, $noreg |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: bb.1.bb1 (ir-block-address-taken %ir-block.bb1): |
| ; CHECK-NEXT: successors: %bb.1(0x20000000), %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f1, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gr64 = COPY $rax |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64_nosp = COPY [[COPY3]] |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr64_nosp = COPY [[COPY1]] |
| ; CHECK-NEXT: JMP64m $noreg, 8, [[COPY2]], @computed_goto.dispatch, $noreg |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: bb.2.bb2 (ir-block-address-taken %ir-block.bb2): |
| ; CHECK-NEXT: successors: %bb.1(0x20000000), %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f2, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gr64 = COPY $rax |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64_nosp = COPY [[COPY4]] |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr64_nosp = COPY [[COPY1]] |
| ; CHECK-NEXT: JMP64m $noreg, 8, [[COPY2]], @computed_goto.dispatch, $noreg |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: bb.3.bb3 (ir-block-address-taken %ir-block.bb3): |
| ; CHECK-NEXT: successors: %bb.1(0x20000000), %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f3, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gr64 = COPY $rax |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64_nosp = COPY [[COPY5]] |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr64_nosp = COPY [[COPY1]] |
| ; CHECK-NEXT: JMP64m $noreg, 8, [[COPY2]], @computed_goto.dispatch, $noreg |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: bb.4.bb4 (ir-block-address-taken %ir-block.bb4): |
| ; CHECK-NEXT: successors: %bb.1(0x20000000), %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000) |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f4, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gr64 = COPY $rax |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64_nosp = COPY [[COPY6]] |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr64_nosp = COPY [[COPY1]] |
| ; CHECK-NEXT: JMP64m $noreg, 8, [[COPY2]], @computed_goto.dispatch, $noreg |
| bb.0: |
| successors: %bb.5(0x80000000) |
| |
| CALL64pcrel32 target-flags(x86-plt) @f0, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| %0:gr64 = COPY $rax |
| %6:gr64_nosp = COPY %0 |
| JMP_1 %bb.5 |
| |
| bb.1.bb1 (ir-block-address-taken %ir-block.bb1): |
| successors: %bb.5(0x80000000) |
| |
| CALL64pcrel32 target-flags(x86-plt) @f1, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| %1:gr64 = COPY $rax |
| %6:gr64_nosp = COPY %1 |
| JMP_1 %bb.5 |
| |
| bb.2.bb2 (ir-block-address-taken %ir-block.bb2): |
| successors: %bb.5(0x80000000) |
| |
| CALL64pcrel32 target-flags(x86-plt) @f2, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| %2:gr64 = COPY $rax |
| %6:gr64_nosp = COPY %2 |
| JMP_1 %bb.5 |
| |
| bb.3.bb3 (ir-block-address-taken %ir-block.bb3): |
| successors: %bb.5(0x80000000) |
| |
| CALL64pcrel32 target-flags(x86-plt) @f3, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| %3:gr64 = COPY $rax |
| %6:gr64_nosp = COPY %3 |
| JMP_1 %bb.5 |
| |
| bb.4.bb4 (ir-block-address-taken %ir-block.bb4): |
| successors: %bb.5(0x80000000) |
| |
| CALL64pcrel32 target-flags(x86-plt) @f4, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| %4:gr64 = COPY $rax |
| %6:gr64_nosp = COPY %4 |
| |
| bb.5: |
| successors: %bb.1(0x20000000), %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000) |
| |
| %5:gr64_nosp = COPY %6 |
| JMP64m $noreg, 8, %5, @computed_goto.dispatch, $noreg |
| ... |