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
4 # This test case was originally known as
5 # test/CodeGen/PowerPC/2013-07-01-PHIElimBug.ll
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.
14 target datalayout = "E-m:e-i64:64-n32:64"
15 target triple = "powerpc64-unknown-linux-gnu"
17 @g_51 = external global [8 x i32], align 4
18 define void @func_7() {
25 tracksRegLiveness: true
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))
33 %3:crrc = CMPLWI killed %2, 0
34 BCC 76, killed %3, %bb.2
37 %4:g8rc = ADDI8 killed %1, 24
41 %5:g8rc = ADDI8 killed %1, 24
43 %7:crrc = CMPLWI undef %8:gprc, 20
46 %9:g8rc = PHI %5, %bb.2, %10, %bb.3
47 %10:g8rc = PHI %6, %bb.2, undef %11:g8rc, %bb.3
52 %12:g8rc_and_g8rc_nox0 = PHI %4, %bb.1, %9, %bb.3
54 STW8 killed %13, 0, killed %12 :: (store (s32))
55 BLR8 implicit $lr8, implicit $rm
59 # Original TR (and 2013-07-01-PHIElimBug.ll) was about verifier errors for bb.3.
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.
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
72 # CHECK: %4:g8rc = ADDI8 killed %1, 24
73 # CHECK-NEXT: %16:g8rc_and_g8rc_nox0 = COPY killed %4
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
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
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