1 # RUN: llc -run-pass register-coalescer %s -o - | FileCheck %s
3 target datalayout = "e-m:e-i64:64-n32:64"
4 target triple = "powerpc64le-unknown-linux-gnu"
6 @b = common dso_local local_unnamed_addr global i32 0, align 4
7 @d = common dso_local local_unnamed_addr global i32 0, align 4
8 @e = common dso_local local_unnamed_addr global ptr null, align 8
9 @c = common dso_local local_unnamed_addr global i32 0, align 4
10 @a = common dso_local local_unnamed_addr global [1 x i32] zeroinitializer, align 4
12 ; Function Attrs: norecurse nounwind
13 define dso_local signext i32 @copycrunset() local_unnamed_addr #0 {
15 %0 = load i32, ptr @b, align 4
16 %tobool3 = icmp eq i32 %0, 0
17 br i1 %tobool3, label %while.end, label %while.body.preheader
19 while.body.preheader: ; preds = %entry
20 %.pre = load i32, ptr @d, align 4
21 %tobool1 = icmp eq i32 %.pre, 0
24 while.body: ; preds = %land.end, %while.body.preheader
25 br i1 %tobool1, label %land.end, label %land.rhs
27 land.rhs: ; preds = %while.body
28 %1 = load ptr, ptr @e, align 8
29 %2 = load i32, ptr %1, align 4
30 %idxprom = sext i32 %2 to i64
31 %arrayidx = getelementptr inbounds [1 x i32], ptr @a, i64 0, i64 %idxprom
32 %3 = load i32, ptr %arrayidx, align 4
33 %tobool2 = icmp ne i32 %3, 0
36 land.end: ; preds = %land.rhs, %while.body
37 %4 = phi i1 [ false, %while.body ], [ %tobool2, %land.rhs ]
38 %land.ext = zext i1 %4 to i32
39 store i32 %land.ext, ptr @c, align 4
42 while.end: ; preds = %entry
50 exposesReturnsTwice: false
52 regBankSelected: false
55 tracksRegLiveness: true
58 - { id: 0, class: crbitrc, preferred-register: '' }
59 - { id: 1, class: crbitrc, preferred-register: '' }
60 - { id: 2, class: crbitrc, preferred-register: '' }
61 - { id: 3, class: g8rc_and_g8rc_nox0, preferred-register: '' }
62 - { id: 4, class: gprc, preferred-register: '' }
63 - { id: 5, class: crrc, preferred-register: '' }
64 - { id: 6, class: g8rc_and_g8rc_nox0, preferred-register: '' }
65 - { id: 7, class: gprc, preferred-register: '' }
66 - { id: 8, class: crrc, preferred-register: '' }
67 - { id: 9, class: crbitrc, preferred-register: '' }
68 - { id: 10, class: g8rc_and_g8rc_nox0, preferred-register: '' }
69 - { id: 11, class: g8rc_and_g8rc_nox0, preferred-register: '' }
70 - { id: 12, class: g8rc, preferred-register: '' }
71 - { id: 13, class: g8rc_and_g8rc_nox0, preferred-register: '' }
72 - { id: 14, class: g8rc_and_g8rc_nox0, preferred-register: '' }
73 - { id: 15, class: g8rc, preferred-register: '' }
74 - { id: 16, class: gprc, preferred-register: '' }
75 - { id: 17, class: crrc, preferred-register: '' }
76 - { id: 18, class: crbitrc, preferred-register: '' }
77 - { id: 19, class: gprc_and_gprc_nor0, preferred-register: '' }
78 - { id: 20, class: gprc_and_gprc_nor0, preferred-register: '' }
79 - { id: 21, class: gprc, preferred-register: '' }
80 - { id: 22, class: g8rc_and_g8rc_nox0, preferred-register: '' }
81 - { id: 23, class: g8rc, preferred-register: '' }
82 - { id: 24, class: crbitrc, preferred-register: '' }
84 - { reg: '$x2', virtual-reg: '' }
86 isFrameAddressTaken: false
87 isReturnAddressTaken: false
96 maxCallFrameSize: 4294967295
97 cvBytesOfCalleeSavedRegisters: 0
98 hasOpaqueSPAdjustment: false
100 hasMustTailInVarArgFunc: false
107 machineFunctionInfo: {}
110 successors: %bb.5(0x30000000), %bb.1(0x50000000)
113 %3:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @b
114 %4:gprc = LWZ target-flags(ppc-toc-lo) @b, killed %3, implicit $x2 :: (dereferenceable load (s32) from @b)
115 %5:crrc = CMPLWI killed %4, 0
116 BCC 76, killed %5, %bb.5
119 bb.1.while.body.preheader:
120 successors: %bb.2(0x80000000)
123 %6:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @d
124 %7:gprc = LWZ target-flags(ppc-toc-lo) @d, killed %6, implicit $x2 :: (dereferenceable load (s32) from @d)
125 %8:crrc = CMPWI killed %7, 0
126 %0:crbitrc = COPY killed %8.sub_eq
128 %19:gprc_and_gprc_nor0 = LI 0
129 %20:gprc_and_gprc_nor0 = LI 1
130 %22:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @c
131 %10:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @e
132 %13:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @a
133 %14:g8rc_and_g8rc_nox0 = ADDItocL killed %13, @a, implicit $x2
136 successors: %bb.4(0x30000000), %bb.3(0x50000000)
139 %24:crbitrc = COPY %9
144 successors: %bb.4(0x80000000)
147 %11:g8rc_and_g8rc_nox0 = LD target-flags(ppc-toc-lo) @e, %10, implicit $x2 :: (dereferenceable load (s64) from @e)
148 %12:g8rc = LWA 0, killed %11 :: (load (s32) from %ir.1)
149 %15:g8rc = RLDICR killed %12, 2, 61
150 %16:gprc = LWZX %14, killed %15 :: (load (s32) from %ir.arrayidx)
151 %17:crrc = CMPWI killed %16, 0
152 %18:crbitrc = COPY killed %17.sub_eq
153 %1:crbitrc = CRNOR killed %18, %18
154 %24:crbitrc = COPY killed %1
157 successors: %bb.2(0x80000000)
160 %2:crbitrc = COPY killed %24
161 %21:gprc = ISEL %20, %19, killed %2
162 STW killed %21, target-flags(ppc-toc-lo) @c, %22, implicit $x2 :: (store (s32) into @c)
167 $x3 = COPY killed %23
168 BLR8 implicit $lr8, implicit $rm, implicit killed $x3
171 #Copy of CRUNSET should be removed in register coalescing pass
172 #CHECK-LABEL: copycrunset
173 #CHECK: bb.1.while.body.preheader:
174 #CHECK-NOT: %9:crbitrc = CRUNSET
175 #CHECK: bb.2.while.body:
176 #CHECK-NOT: %24:crbitrc = COPY %9
177 #CHECK: %24:crbitrc = CRUNSET