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