133 lines · plain
1# RUN: llc -verify-machineinstrs -start-before=ppc-pre-emit-peephole %s -o - | FileCheck %s2--- |3 target datalayout = "e-m:e-i64:64-n32:64"4 target triple = "powerpc64le-unknown-linux-gnu"5 6 declare signext i32 @callee(i32 signext) local_unnamed_addr #17 8 define signext i32 @func(i32 signext %v) local_unnamed_addr #0 {9 entry:10 %call.i = tail call signext i32 @callee(i32 signext %v)11 %tobool.i = icmp eq i32 %call.i, 012 br i1 %tobool.i, label %if.else.i, label %if.then.i13 14 if.then.i: ; preds = %entry15 %call2.i = tail call signext i32 @callee(i32 signext %call.i)16 br label %_Z6calleei.exit17 18 if.else.i: ; preds = %entry19 %phitmp = icmp sgt i32 %v, -120 br label %_Z6calleei.exit21 22 _Z6calleei.exit: ; preds = %if.else.i, %if.then.i23 %call2.i.sink = phi i32 [ %call2.i, %if.then.i ], [ %v, %if.else.i ]24 %.sink = phi i1 [ false, %if.then.i ], [ %phitmp, %if.else.i ]25 br i1 %.sink, label %if.end, label %if.then26 27 if.then: ; preds = %_Z6calleei.exit28 %call1 = tail call signext i32 @callee(i32 signext 0)29 br label %if.end30 31 if.end: ; preds = %if.then, %_Z6calleei.exit32 ret i32 %call2.i.sink33 }34 35 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "use-soft-float"="false" }36 attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "use-soft-float"="false" }37 38...39---40name: func41alignment: 1642exposesReturnsTwice: false43legalized: false44regBankSelected: false45selected: false46failedISel: false47tracksRegLiveness: true48registers: 49liveins: 50 - { reg: '$x3', virtual-reg: '' }51frameInfo: 52 isFrameAddressTaken: false53 isReturnAddressTaken: false54 hasStackMap: false55 hasPatchPoint: false56 stackSize: 4857 offsetAdjustment: 058 maxAlignment: 059 adjustsStack: true60 hasCalls: true61 stackProtector: ''62 maxCallFrameSize: 3263 hasOpaqueSPAdjustment: false64 hasVAStart: false65 hasMustTailInVarArgFunc: false66 localFrameSize: 067 savePoint: []68 restorePoint: []69fixedStack: 70 - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,71 callee-saved-register: '$x30', callee-saved-restored: true, debug-info-variable: '', 72 debug-info-expression: '', debug-info-location: '' }73stack: 74constants: 75 76body: |77 bb.0.entry:78 successors: %bb.2(0x30000000), %bb.1(0x50000000)79 liveins: $x3, $x3080 81 ; bc should be converted into b, and creqv (CRSET) should be removed since it isn't used.82 ; CHECK-LABEL: func83 ; CHECK: # %bb.184 ; CHECK-NOT: creqv85 ; CHECK-NOT: bc86 ; CHECK: .LBB0_287 88 $x0 = MFLR8 implicit $lr889 STD killed $x0, 16, $x190 $x1 = STDU $x1, -48, $x191 STD killed $x30, 32, $x1 :: (store (s64) into %fixed-stack.0, align 16)92 $x30 = OR8 $x3, $x393 BL8_NOP @callee, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def $x394 renamable $cr0 = CMPLWI renamable $r3, 095 BCC 76, killed renamable $cr0, %bb.296 97 bb.1.if.then.i:98 successors: %bb.5(0x40000000), %bb.4(0x40000000)99 liveins: $x3100 101 renamable $x3 = EXTSW_32_64 killed renamable $r3, implicit $x3102 BL8_NOP @callee, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def $x3103 renamable $cr0gt = CRSET implicit-def $cr0104 $x30 = OR8 killed $x3, $x3105 BC killed renamable $cr0gt, %bb.5106 107 bb.4.if.then:108 successors: %bb.5(0x80000000)109 liveins: $x30110 111 $x3 = LI8 0112 BL8_NOP @callee, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def dead $x3113 114 bb.5.if.end:115 liveins: $x30116 117 renamable $x3 = EXTSW_32_64 killed renamable $r30, implicit $x30118 $x30 = LD 32, $x1 :: (load (s64) from %fixed-stack.0, align 16)119 $x1 = ADDI8 $x1, 48120 $x0 = LD 16, $x1121 MTLR8 killed $x0, implicit-def $lr8122 BLR8 implicit $lr8, implicit $rm, implicit killed $x3123 124 bb.2.if.else.i:125 successors: %bb.5(0x40000000), %bb.4(0x40000000)126 liveins: $x30127 128 renamable $cr0 = CMPWI renamable $r30, -1129 BCn killed renamable $cr0gt, %bb.4130 B %bb.5131 132...133