llvm.org GIT mirror llvm / master test / CodeGen / PowerPC / block-placement-1.mir
master

Tree @master (Download .tar.gz)

block-placement-1.mir @masterraw · history · blame

# RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64le-unknown-linux-gnu \
# RUN:   -run-pass=block-placement -o - %s | FileCheck %s
--- |
  ; ModuleID = 'test.ll'
  source_filename = "test.ll"
  target datalayout = "e-m:e-i64:64-n32:64"
  
  @_ZTIl = external constant i8*
  @_ZTIi = external constant i8*
  @_ZTIc = external constant i8*
  
  define dso_local void @_Z6calleev() local_unnamed_addr {
  entry:
    tail call void @__cxa_rethrow()
    unreachable
  }
  
  declare void @__cxa_rethrow() local_unnamed_addr
  
  define dso_local void @_Z14TestSinglePredv() local_unnamed_addr personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
  entry:
    br label %for.body
  
  for.cond.cleanup:                                 ; preds = %for.inc
    ret void
  
  for.body:                                         ; preds = %for.inc, %entry
    %lsr.iv = phi i32 [ %lsr.iv.next, %for.inc ], [ 10, %entry ]
    invoke void @__cxa_rethrow()
            to label %.noexc unwind label %lpad
  
  .noexc:                                           ; preds = %for.body
    unreachable
  
  lpad:                                             ; preds = %for.body
    %0 = landingpad { i8*, i32 }
            catch i8* bitcast (i8** @_ZTIl to i8*)
            catch i8* bitcast (i8** @_ZTIi to i8*)
            catch i8* null
    %1 = extractvalue { i8*, i32 } %0, 0
    %2 = extractvalue { i8*, i32 } %0, 1
    %3 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIl to i8*))
    %matches = icmp eq i32 %2, %3
    br i1 %matches, label %catch4, label %catch.fallthrough
  
  catch4:                                           ; preds = %lpad
    %4 = tail call i8* @__cxa_begin_catch(i8* %1)
    invoke void @__cxa_rethrow()
            to label %unreachable unwind label %lpad6
  
  catch.fallthrough:                                ; preds = %lpad
    %5 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
    %matches1 = icmp eq i32 %2, %5
    %6 = tail call i8* @__cxa_begin_catch(i8* %1)
    br i1 %matches1, label %catch2, label %catch
  
  catch2:                                           ; preds = %catch.fallthrough
    tail call void @__cxa_end_catch()
    br label %for.inc
  
  catch:                                            ; preds = %catch.fallthrough
    tail call void @__cxa_end_catch()
    br label %for.inc
  
  lpad6:                                            ; preds = %catch4
    %7 = landingpad { i8*, i32 }
            cleanup
            catch i8* bitcast (i8** @_ZTIc to i8*)
    %8 = extractvalue { i8*, i32 } %7, 1
    %9 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIc to i8*))
    %matches9 = icmp eq i32 %8, %9
    br i1 %matches9, label %catch10, label %ehcleanup
  
  catch10:                                          ; preds = %lpad6
    %10 = extractvalue { i8*, i32 } %7, 0
    %11 = tail call i8* @__cxa_begin_catch(i8* %10)
    tail call void @__cxa_end_catch()
    tail call void @__cxa_end_catch()
    br label %for.inc
  
  for.inc:                                          ; preds = %catch10, %catch, %catch2
    %lsr.iv.next = add nsw i32 %lsr.iv, -1
    %exitcond = icmp eq i32 %lsr.iv.next, 0
    br i1 %exitcond, label %for.cond.cleanup, label %for.body
  
  ehcleanup:                                        ; preds = %lpad6
    tail call void @__cxa_end_catch()
    %exn.obj = extractvalue { i8*, i32 } %7, 0
    call void @_Unwind_Resume(i8* %exn.obj)
    unreachable
  
  unreachable:                                      ; preds = %catch4
    unreachable
  }
  
  declare i32 @__gxx_personality_v0(...)
  
  ; Function Attrs: nounwind readnone
  declare i32 @llvm.eh.typeid.for(i8*) #0
  
  declare i8* @__cxa_begin_catch(i8*) local_unnamed_addr
  
  declare void @__cxa_end_catch() local_unnamed_addr
  
  ; Function Attrs: nounwind
  declare void @llvm.stackprotector(i8*, i8**) #1
  
  declare void @_Unwind_Resume(i8*)
  
  attributes #0 = { nounwind readnone }
  attributes #1 = { nounwind }

...
---
name:            _Z6calleev
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
hasWinCFI:       false
registers:       []
liveins:         []
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       32
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    true
  hasCalls:        true
  stackProtector:  ''
  maxCallFrameSize: 32
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:      []
stack:           []
callSites:       []
constants:       []
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    $x0 = MFLR8 implicit $lr8
    STD killed $x0, 16, $x1
    $x1 = STDU $x1, -32, $x1
    CFI_INSTRUCTION def_cfa_offset 32
    CFI_INSTRUCTION offset $lr8, 16
    BL8_NOP @__cxa_rethrow, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1

...
---
name:            _Z14TestSinglePredv
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
hasWinCFI:       false
registers:       []
liveins:         []
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       64
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    true
  hasCalls:        true
  stackProtector:  ''
  maxCallFrameSize: 32
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:
  - { id: 0, type: spill-slot, offset: -80, size: 8, alignment: 16, stack-id: default, 
      callee-saved-register: '$x30', callee-saved-restored: true, debug-info-variable: '', 
      debug-info-expression: '', debug-info-location: '' }
  - { id: 1, type: spill-slot, offset: -88, size: 8, alignment: 8, stack-id: default, 
      callee-saved-register: '$x29', callee-saved-restored: true, debug-info-variable: '', 
      debug-info-expression: '', debug-info-location: '' }
stack:           []
callSites:       []
constants:       []
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    successors: %bb.1(0x80000000)
    liveins: $x29, $x30
  
    $x0 = MFLR8 implicit $lr8
    CFI_INSTRUCTION def_cfa_offset 64
    CFI_INSTRUCTION offset $lr8, 16
    CFI_INSTRUCTION offset $x29, -24
    CFI_INSTRUCTION offset $x30, -16
    STD killed $x29, -24, $x1 :: (store 8 into %fixed-stack.1)
    STD killed $x30, -16, $x1 :: (store 8 into %fixed-stack.0, align 16)
    STD killed $x0, 16, $x1
    $x1 = STDU $x1, -64, $x1
    renamable $r29 = LI 10
  
  bb.1.for.body:
    successors: %bb.2(0x7ffff800), %bb.3(0x00000800)
    liveins: $r29
  
    EH_LABEL <mcsymbol .Ltmp0>
    BL8_NOP @__cxa_rethrow, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
    EH_LABEL <mcsymbol .Ltmp1>
  
  bb.2..noexc:
    successors: 
  
  
  bb.3.lpad (landing-pad):
    successors: %bb.4(0x00000001), %bb.5(0x7fffffff)
    liveins: $r29, $x3, $x4
  
    EH_LABEL <mcsymbol .Ltmp2>
    $x30 = OR8 killed $x4, $x4
    renamable $cr0 = CMPLWI renamable $r30, 3
    BCC 71, killed renamable $cr0, %bb.5
  
  bb.4.catch4:
    successors: %bb.11(0x7ffff800), %bb.6(0x00000800)
    liveins: $r29, $x3
  
    BL8_NOP @__cxa_begin_catch, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def dead $x3
    EH_LABEL <mcsymbol .Ltmp3>
    BL8_NOP @__cxa_rethrow, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
    EH_LABEL <mcsymbol .Ltmp4>
    B %bb.11
  
  bb.5.catch.fallthrough:
    successors: %bb.8(0x80000000)
    liveins: $r29, $x3, $x30
  
    BL8_NOP @__cxa_begin_catch, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def dead $x3
    renamable $cr0 = CMPLWI killed renamable $r30, 2, implicit $x30
    B %bb.8
  
  bb.6.lpad6 (landing-pad):
    successors: %bb.7(0x7fffffff), %bb.10(0x00000001)
    liveins: $r29, $x3, $x4
  
    EH_LABEL <mcsymbol .Ltmp5>
    renamable $cr0 = CMPLWI killed renamable $r4, 4, implicit $x4
    $x30 = OR8 killed $x3, $x3
    BCC 70, killed renamable $cr0, %bb.10
  
  bb.7.catch10:
    successors: %bb.8(0x80000000)
    liveins: $r29, $x30
  
    $x3 = OR8 killed $x30, $x30
    BL8_NOP @__cxa_begin_catch, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit-def $r1, implicit-def dead $x3
    BL8_NOP @__cxa_end_catch, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
  
  bb.8.for.inc:
    successors: %bb.9(0x04000000), %bb.1(0x7c000000)
    liveins: $r29
  
    BL8_NOP @__cxa_end_catch, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
    renamable $r29 = nsw ADDI killed renamable $r29, -1
    renamable $cr0 = CMPLWI renamable $r29, 0
    BCC 68, killed renamable $cr0, %bb.1
  
  bb.9.for.cond.cleanup:
    $x1 = ADDI8 $x1, 64
    $x0 = LD 16, $x1
    MTLR8 killed $x0, implicit-def $lr8
    $x30 = LD -16, $x1 :: (load 8 from %fixed-stack.0, align 16)
    $x29 = LD -24, $x1 :: (load 8 from %fixed-stack.1)
    BLR8 implicit $lr8, implicit $rm
  
  bb.10.ehcleanup:
    successors: 
    liveins: $x30
  
    BL8_NOP @__cxa_end_catch, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
    $x3 = OR8 killed $x30, $x30
    BL8_NOP @_Unwind_Resume, csr_svr464_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit-def $r1
  
  bb.11.unreachable:

  ; CHECK:      bb.1.for.body:
  ; CHECK:        successors: %bb.2(0x7ffff800), %bb.3(0x00000800)
  ; CHECK:        B %bb.2

  ; CHECK:      bb.4.catch4:
  ; CHECK:        successors: %bb.11(0x7ffff800), %bb.6(0x00000800)
  ; CHECK:        B %bb.11

  ; CHECK:      bb.2..noexc:

  ; CHECK:      bb.11.unreachable: 
...