179 lines · plain
1# RUN: llc -run-pass register-coalescer %s -o - | FileCheck %s2--- |3 target datalayout = "e-m:e-i64:64-n32:64"4 target triple = "powerpc64le-unknown-linux-gnu"5 6 @b = common dso_local local_unnamed_addr global i32 0, align 47 @d = common dso_local local_unnamed_addr global i32 0, align 48 @e = common dso_local local_unnamed_addr global ptr null, align 89 @c = common dso_local local_unnamed_addr global i32 0, align 410 @a = common dso_local local_unnamed_addr global [1 x i32] zeroinitializer, align 411 12 ; Function Attrs: norecurse nounwind13 define dso_local signext i32 @copycrunset() local_unnamed_addr #0 {14 entry:15 %0 = load i32, ptr @b, align 416 %tobool3 = icmp eq i32 %0, 017 br i1 %tobool3, label %while.end, label %while.body.preheader18 19 while.body.preheader: ; preds = %entry20 %.pre = load i32, ptr @d, align 421 %tobool1 = icmp eq i32 %.pre, 022 br label %while.body23 24 while.body: ; preds = %land.end, %while.body.preheader25 br i1 %tobool1, label %land.end, label %land.rhs26 27 land.rhs: ; preds = %while.body28 %1 = load ptr, ptr @e, align 829 %2 = load i32, ptr %1, align 430 %idxprom = sext i32 %2 to i6431 %arrayidx = getelementptr inbounds [1 x i32], ptr @a, i64 0, i64 %idxprom32 %3 = load i32, ptr %arrayidx, align 433 %tobool2 = icmp ne i32 %3, 034 br label %land.end35 36 land.end: ; preds = %land.rhs, %while.body37 %4 = phi i1 [ false, %while.body ], [ %tobool2, %land.rhs ]38 %land.ext = zext i1 %4 to i3239 store i32 %land.ext, ptr @c, align 440 br label %while.body41 42 while.end: ; preds = %entry43 ret i32 undef44 }45 46...47---48name: copycrunset49alignment: 1650exposesReturnsTwice: false51legalized: false52regBankSelected: false53selected: false54failedISel: false55tracksRegLiveness: true56hasWinCFI: false57registers: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: '' }83liveins:84 - { reg: '$x2', virtual-reg: '' }85frameInfo:86 isFrameAddressTaken: false87 isReturnAddressTaken: false88 hasStackMap: false89 hasPatchPoint: false90 stackSize: 091 offsetAdjustment: 092 maxAlignment: 093 adjustsStack: false94 hasCalls: false95 stackProtector: ''96 maxCallFrameSize: 429496729597 cvBytesOfCalleeSavedRegisters: 098 hasOpaqueSPAdjustment: false99 hasVAStart: false100 hasMustTailInVarArgFunc: false101 localFrameSize: 0102 savePoint: []103 restorePoint: []104fixedStack: []105stack: []106constants: []107machineFunctionInfo: {}108body: |109 bb.0.entry:110 successors: %bb.5(0x30000000), %bb.1(0x50000000)111 liveins: $x2112 113 %3:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @b114 %4:gprc = LWZ target-flags(ppc-toc-lo) @b, killed %3, implicit $x2 :: (dereferenceable load (s32) from @b)115 %5:crrc = CMPLWI killed %4, 0116 BCC 76, killed %5, %bb.5117 B %bb.1118 119 bb.1.while.body.preheader:120 successors: %bb.2(0x80000000)121 liveins: $x2122 123 %6:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @d124 %7:gprc = LWZ target-flags(ppc-toc-lo) @d, killed %6, implicit $x2 :: (dereferenceable load (s32) from @d)125 %8:crrc = CMPWI killed %7, 0126 %0:crbitrc = COPY killed %8.sub_eq127 %9:crbitrc = CRUNSET128 %19:gprc_and_gprc_nor0 = LI 0129 %20:gprc_and_gprc_nor0 = LI 1130 %22:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @c131 %10:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @e132 %13:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @a133 %14:g8rc_and_g8rc_nox0 = ADDItocL8 killed %13, @a, implicit $x2134 135 bb.2.while.body:136 successors: %bb.4(0x30000000), %bb.3(0x50000000)137 liveins: $x2138 139 %24:crbitrc = COPY %9140 BC %0, %bb.4141 B %bb.3142 143 bb.3.land.rhs:144 successors: %bb.4(0x80000000)145 liveins: $x2146 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, 61150 %16:gprc = LWZX %14, killed %15 :: (load (s32) from %ir.arrayidx)151 %17:crrc = CMPWI killed %16, 0152 %18:crbitrc = COPY killed %17.sub_eq153 %1:crbitrc = CRNOR killed %18, %18154 %24:crbitrc = COPY killed %1155 156 bb.4.land.end:157 successors: %bb.2(0x80000000)158 liveins: $x2159 160 %2:crbitrc = COPY killed %24161 %21:gprc = ISEL %20, %19, killed %2162 STW killed %21, target-flags(ppc-toc-lo) @c, %22, implicit $x2 :: (store (s32) into @c)163 B %bb.2164 165 bb.5.while.end:166 %23:g8rc = LI8 0167 $x3 = COPY killed %23168 BLR8 implicit $lr8, implicit $rm, implicit killed $x3169 170...171#Copy of CRUNSET should be removed in register coalescing pass172#CHECK-LABEL: copycrunset173#CHECK: bb.1.while.body.preheader:174#CHECK-NOT: %9:crbitrc = CRUNSET175#CHECK: bb.2.while.body:176#CHECK-NOT: %24:crbitrc = COPY %9177#CHECK: %24:crbitrc = CRUNSET178#CHECK: B %bb.3179