| 1 |
# RUN: llc -mtriple powerpc64-unknown-linux-gnu -run-pass livevars -run-pass phi-node-elimination -verify-machineinstrs -o - %s | FileCheck %s |
| 2 |
# RUN: llc -mtriple powerpc64-unknown-linux-gnu --passes='require<live-vars>,phi-node-elimination' -verify-each -o - %s | FileCheck %s |
| 3 |
|
| 4 |
# This test case was originally known as |
| 5 |
# test/CodeGen/PowerPC/2013-07-01-PHIElimBug.ll |
| 6 |
# |
| 7 |
# It was discovered that the original test case no longer reproduced the bug |
| 8 |
# from PR16508 (solved in rL185363). That could have been resolved by adding |
| 9 |
# -O1 (or possibly -O0) to the run line, but instead the test case was |
| 10 |
# converted into this .mir test case. Having it as a .mir test should make it |
| 11 |
# less sensitive to changes in earlier passes. |
| 12 |
|
| 13 |
--- | |
| 14 |
target datalayout = "E-m:e-i64:64-n32:64" |
| 15 |
target triple = "powerpc64-unknown-linux-gnu" |
| 16 |
|
| 17 |
@g_51 = external global [8 x i32], align 4 |
| 18 |
define void @func_7() { |
| 19 |
bb.0: |
| 20 |
ret void |
| 21 |
} |
| 22 |
... |
| 23 |
--- |
| 24 |
name: func_7 |
| 25 |
tracksRegLiveness: true |
| 26 |
body: | |
| 27 |
bb.0: |
| 28 |
liveins: $x2 |
| 29 |
|
| 30 |
%0:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @g_51 |
| 31 |
%1:g8rc_and_g8rc_nox0 = LDtocL @g_51, killed %0, implicit $x2 :: (load (s64)) |
| 32 |
%2:gprc = LI 0 |
| 33 |
%3:crrc = CMPLWI killed %2, 0 |
| 34 |
BCC 76, killed %3, %bb.2 |
| 35 |
|
| 36 |
bb.1: |
| 37 |
%4:g8rc = ADDI8 killed %1, 24 |
| 38 |
B %bb.4 |
| 39 |
|
| 40 |
bb.2: |
| 41 |
%5:g8rc = ADDI8 killed %1, 24 |
| 42 |
%6:g8rc = LI8 0 |
| 43 |
%7:crrc = CMPLWI undef %8:gprc, 20 |
| 44 |
|
| 45 |
bb.3: |
| 46 |
%9:g8rc = PHI %5, %bb.2, %10, %bb.3 |
| 47 |
%10:g8rc = PHI %6, %bb.2, undef %11:g8rc, %bb.3 |
| 48 |
BCC 68, %7, %bb.3 |
| 49 |
B %bb.4 |
| 50 |
|
| 51 |
bb.4: |
| 52 |
%12:g8rc_and_g8rc_nox0 = PHI %4, %bb.1, %9, %bb.3 |
| 53 |
%13:g8rc = LI8 0 |
| 54 |
STW8 killed %13, 0, killed %12 :: (store (s32)) |
| 55 |
BLR8 implicit $lr8, implicit $rm |
| 56 |
|
| 57 |
... |
| 58 |
|
| 59 |
# Original TR (and 2013-07-01-PHIElimBug.ll) was about verifier errors for bb.3. |
| 60 |
# |
| 61 |
# I got a feeling that we also need to have some checks to see that # the code |
| 62 |
# is correct in some way. Hopefully this test case is stable enough to verify |
| 63 |
# the full MIR like this. |
| 64 |
# |
| 65 |
# CHECK: bb.0: |
| 66 |
# CHECK: %0:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @g_51 |
| 67 |
# CHECK-NEXT: %1:g8rc_and_g8rc_nox0 = LDtocL @g_51, killed %0, implicit killed $x2 :: (load (s64)) |
| 68 |
# CHECK-NEXT: %2:gprc = LI 0 |
| 69 |
# CHECK-NEXT: %3:crrc = CMPLWI killed %2, 0 |
| 70 |
# CHECK-NEXT: BCC 76, killed %3, %bb.2 |
| 71 |
# CHECK: bb.1: |
| 72 |
# CHECK: %4:g8rc = ADDI8 killed %1, 24 |
| 73 |
# CHECK-NEXT: %16:g8rc_and_g8rc_nox0 = COPY killed %4 |
| 74 |
# CHECK-NEXT: B %bb.4 |
| 75 |
# CHECK: bb.2: |
| 76 |
# CHECK: %5:g8rc = ADDI8 killed %1, 24 |
| 77 |
# CHECK-NEXT: %6:g8rc = LI8 0 |
| 78 |
# CHECK-NEXT: %7:crrc = CMPLWI undef %8:gprc, 20 |
| 79 |
# CHECK-NEXT: %14:g8rc = COPY killed %5 |
| 80 |
# CHECK-NEXT: %15:g8rc = COPY killed %6 |
| 81 |
# CHECK: bb.3: |
| 82 |
# CHECK: %10:g8rc = COPY killed %15 |
| 83 |
# CHECK-NEXT: %9:g8rc = COPY killed %14 |
| 84 |
# CHECK-NEXT: %14:g8rc = COPY killed %10 |
| 85 |
# CHECK-NEXT: %15:g8rc = IMPLICIT_DEF |
| 86 |
# CHECK-NEXT: %16:g8rc_and_g8rc_nox0 = COPY killed %9 |
| 87 |
# CHECK-NEXT: BCC 68, %7, %bb.3 |
| 88 |
# CHECK-NEXT: B %bb.4 |
| 89 |
# CHECK: bb.4: |
| 90 |
# CHECK: %12:g8rc_and_g8rc_nox0 = COPY killed %16 |
| 91 |
# CHECK-NEXT: %13:g8rc = LI8 0 |
| 92 |
# CHECK-NEXT: STW8 killed %13, 0, killed %12 :: (store (s32)) |
| 93 |
# CHECK-NEXT: BLR8 implicit $lr8, implicit $rm |