brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.7 KiB · e298663 Raw
360 lines · plain
1# REQUIRES: asserts2# RUN: llc -run-pass arm-cp-islands %s -o - | FileCheck %s3#4# This is a reduced test made to expose a bug in5# ARMConstantIslandPass in Thumb1 mode, see PR36658.6 7# Verify optimized JT code uses TBB instructions.8# CHECK-LABEL: bb.7.entry:9# CHECK: tTBB_JT $pc, killed $r2, %jump-table.1, 010# CHECK-LABEL: bb.8:11# CHECK: JUMPTABLE_TBB 0, %jump-table.1, 4412 13# CHECK-LABEL: bb.11.entry:14# CHECK: $r1 = tMOVSr $r0, implicit-def dead $cpsr15# CHECK: tTBB_JT $pc, killed $r2, %jump-table.0, 116# CHECK-LABEL: bb.12:17# CHECK: JUMPTABLE_TBB 1, %jump-table.0, 4418 19--- |20  ; ModuleID = 'PR36658.ll'21  source_filename = "PR36658.ll"22  target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"23  target triple = "thumbv5e-none-linux-gnueabi"24 25  declare i32 @foo1(...)26 27  declare i32 @foo2(i32)28 29  declare i32 @foo3(ptr)30 31  ; Function Attrs: nounwind optsize32  define internal fastcc i32 @foo4(ptr nocapture %ignore_ptr) #0 {33  entry:34    %call = tail call i32 @foo3(ptr undef)35    switch i32 %call, label %sw.epilog [36      i32 120, label %sw.bb37      i32 48, label %sw.bb7338      i32 49, label %sw.bb7339      i32 50, label %sw.bb7340      i32 51, label %sw.bb7341      i32 52, label %sw.bb7342      i32 53, label %sw.bb7343      i32 54, label %sw.bb7344      i32 55, label %sw.bb7345      i32 92, label %cleanup46      i32 39, label %cleanup47      i32 34, label %cleanup48      i32 10, label %sw.bb9149      i32 110, label %sw.bb9350      i32 116, label %sw.bb9451      i32 114, label %sw.bb9552      i32 102, label %sw.bb9653      i32 98, label %sw.bb9754      i32 97, label %sw.bb9855      i32 118, label %sw.bb10656      i32 101, label %sw.bb10757      i32 69, label %sw.bb10758      i32 63, label %cleanup59    ]60 61  sw.bb:                                            ; preds = %entry62    br label %while.cond63 64  while.cond:                                       ; preds = %while.cond, %sw.bb65    %call5 = tail call i32 @foo3(ptr null)66    br label %while.cond67 68  sw.bb73:                                          ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry69    %0 = and i32 %call, -870    %1 = icmp eq i32 %0, 4871    br i1 %1, label %while.body83.preheader, label %while.end8872 73  while.body83.preheader:                           ; preds = %sw.bb7374    br label %while.body8375 76  while.body83:                                     ; preds = %while.body83.preheader, %while.body8377    %call87 = tail call i32 @foo3(ptr null)78    br label %while.body8379 80  while.end88:                                      ; preds = %sw.bb7381    %call89 = tail call i32 @foo2(i32 %call)82    unreachable83 84  sw.bb91:                                          ; preds = %entry85    store i32 1, ptr %ignore_ptr, align 486    br label %cleanup87 88  sw.bb93:                                          ; preds = %entry89    br label %cleanup90 91  sw.bb94:                                          ; preds = %entry92    br label %cleanup93 94  sw.bb95:                                          ; preds = %entry95    br label %cleanup96 97  sw.bb96:                                          ; preds = %entry98    br label %cleanup99 100  sw.bb97:                                          ; preds = %entry101    br label %cleanup102 103  sw.bb98:                                          ; preds = %entry104    br label %cleanup105 106  sw.bb106:                                         ; preds = %entry107    br label %cleanup108 109  sw.bb107:                                         ; preds = %entry, %entry110    br i1 undef, label %cleanup, label %if.then109111 112  if.then109:                                       ; preds = %sw.bb107113    %call110 = tail call i32 @foo1(ptr undef, i32 %call)114    unreachable115 116  sw.epilog:                                        ; preds = %entry117    %call.off = add i32 %call, -32118    unreachable119 120  cleanup:                                          ; preds = %sw.bb107, %sw.bb106, %sw.bb98, %sw.bb97, %sw.bb96, %sw.bb95, %sw.bb94, %sw.bb93, %sw.bb91, %entry, %entry, %entry, %entry121    %retval.0 = phi i32 [ 11, %sw.bb106 ], [ 7, %sw.bb98 ], [ 8, %sw.bb97 ], [ 12, %sw.bb96 ], [ 13, %sw.bb95 ], [ 9, %sw.bb94 ], [ 10, %sw.bb93 ], [ 0, %sw.bb91 ], [ %call, %entry ], [ %call, %entry ], [ %call, %entry ], [ 27, %sw.bb107 ], [ %call, %entry ]122    ret i32 %retval.0123  }124 125  ; Function Attrs: nounwind126  declare void @llvm.stackprotector(ptr, ptr) #1127 128  attributes #0 = { nounwind optsize }129  attributes #1 = { nounwind }130 131...132---133name:            foo4134alignment:       2135tracksRegLiveness: true136liveins:137  - { reg: '$r0' }138frameInfo:139  stackSize:       8140  maxAlignment:    4141  adjustsStack:    true142  hasCalls:        true143  maxCallFrameSize: 0144stack:145  - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, stack-id: default,146      callee-saved-register: '$lr', callee-saved-restored: false }147  - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: default,148      callee-saved-register: '$r4' }149jumpTable:150  kind:            inline151  entries:152    - id:              0153      blocks:          [ '%bb.28', '%bb.26', '%bb.26', '%bb.26', '%bb.26',154                         '%bb.24', '%bb.23', '%bb.26', '%bb.26', '%bb.12',155                         '%bb.22' ]156    - id:              1157      blocks:          [ '%bb.19', '%bb.26', '%bb.26', '%bb.26', '%bb.21',158                         '%bb.26', '%bb.20', '%bb.26', '%bb.25', '%bb.26',159                         '%bb.15' ]160body:             |161  bb.0.entry:162    successors: %bb.1(0x42c8590b), %bb.9(0x3d37a6f5)163    liveins: $r0, $r4, $lr164 165    frame-setup tPUSH 14, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp166    frame-setup CFI_INSTRUCTION def_cfa_offset 8167    frame-setup CFI_INSTRUCTION offset $lr, -4168    frame-setup CFI_INSTRUCTION offset $r4, -8169    $r4 = tMOVSr $r0, implicit-def dead $cpsr170    tBL 14, $noreg, @foo3, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit undef $r0, implicit-def $sp, implicit-def $r0171    $r1 = tMOVSr $r0, implicit-def dead $cpsr172    tCMPi8 $r0, 68, 14, $noreg, implicit-def $cpsr173    tBcc %bb.9, 12, killed $cpsr174 175  bb.1.entry:176    successors: %bb.2(0x20000000), %bb.7(0x60000000)177    liveins: $r0, $r1, $r4178 179    tCMPi8 renamable $r1, 47, 14, $noreg, implicit-def $cpsr180    tBcc %bb.2, 13, killed $cpsr181 182  bb.7.entry:183    successors: %bb.16(0x71c71c72), %bb.8(0x0e38e38e)184    liveins: $r0, $r1185 186    $r2 = tMOVSr $r1, implicit-def dead $cpsr187    renamable $r2, dead $cpsr = tSUBi8 killed renamable $r2, 48, 14, $noreg188    tCMPi8 killed renamable $r2, 8, 14, $noreg, implicit-def $cpsr189    tBcc %bb.8, 2, killed $cpsr190 191  bb.16.sw.bb73:192    successors: %bb.17(0x7fffffff), %bb.18(0x00000001)193    liveins: $r0, $r1194 195    renamable $r2, dead $cpsr = tMOVi8 7, 14, $noreg196    renamable $r1, dead $cpsr = tBIC killed renamable $r1, killed renamable $r2, 14, $noreg197    tCMPi8 killed renamable $r1, 48, 14, $noreg, implicit-def $cpsr198    tBcc %bb.18, 1, killed $cpsr199 200  bb.17.while.body83:201    renamable $r0, dead $cpsr = tMOVi8 0, 14, $noreg202    tBL 14, $noreg, @foo3, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp, implicit-def dead $r0203    tB %bb.17, 14, $noreg204 205  bb.9.entry:206    successors: %bb.10(0x45d1745d), %bb.29(0x3a2e8ba3)207    liveins: $r0, $r1208 209    $r2 = tMOVSr $r1, implicit-def dead $cpsr210    renamable $r2, dead $cpsr = tSUBi8 killed renamable $r2, 92, 14, $noreg211    tCMPi8 renamable $r2, 10, 14, $noreg, implicit-def $cpsr212    tBcc %bb.29, 9, killed $cpsr213 214  bb.10.entry:215    successors: %bb.11(0x15555555), %bb.14(0x6aaaaaab)216    liveins: $r0, $r1217 218    $r2 = tMOVSr $r1, implicit-def dead $cpsr219    renamable $r2, dead $cpsr = tSUBi8 killed renamable $r2, 110, 14, $noreg220    tCMPi8 renamable $r2, 10, 14, $noreg, implicit-def $cpsr221    tBcc %bb.11, 8, killed $cpsr222 223  bb.14.entry:224    successors: %bb.19(0x1999999a), %bb.26(0x00000000), %bb.21(0x1999999a), %bb.20(0x1999999a), %bb.25(0x1999999a), %bb.15(0x1999999a)225    liveins: $r2226 227    renamable $r0, dead $cpsr = tLSLri killed renamable $r2, 2, 14, $noreg228    renamable $r1 = tLEApcrelJT %jump-table.1, 14, $noreg229    renamable $r0 = tLDRr killed renamable $r1, killed renamable $r0, 14, $noreg :: (load (s32) from jump-table)230    tBR_JTr killed renamable $r0, %jump-table.1231 232  bb.19.sw.bb93:233    renamable $r1, dead $cpsr = tMOVi8 10, 14, $noreg234    tB %bb.28, 14, $noreg235 236  bb.15.while.cond:237    renamable $r0, dead $cpsr = tMOVi8 0, 14, $noreg238    tBL 14, $noreg, @foo3, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp, implicit-def dead $r0239    tB %bb.15, 14, $noreg240 241  bb.29.entry:242    successors: %bb.28(0x1999999a), %bb.26(0x00000000), %bb.24(0x1999999a), %bb.23(0x1999999a), %bb.12(0x1999999a), %bb.22(0x1999999a)243    liveins: $r0, $r2244 245    renamable $r1, dead $cpsr = tLSLri killed renamable $r2, 2, 14, $noreg246    renamable $r2 = tLEApcrelJT %jump-table.0, 14, $noreg247    renamable $r2 = tLDRr killed renamable $r2, killed renamable $r1, 14, $noreg :: (load (s32) from jump-table)248    $r1 = tMOVSr $r0, implicit-def dead $cpsr249    tBR_JTr killed renamable $r2, %jump-table.0250 251  bb.24.sw.bb98:252    renamable $r1, dead $cpsr = tMOVi8 7, 14, $noreg253    tB %bb.28, 14, $noreg254 255  bb.2.entry:256    successors: %bb.27(0x2aaaaaab), %bb.3(0x55555555)257    liveins: $r0, $r1, $r4258 259    tCMPi8 renamable $r1, 10, 14, $noreg, implicit-def $cpsr260    tBcc %bb.27, 0, killed $cpsr261 262  bb.3.entry:263    successors: %bb.4, %bb.5264    liveins: $r0, $r1265 266    tCMPi8 renamable $r1, 34, 14, $noreg, implicit-def $cpsr267    tBcc %bb.5, 1, killed $cpsr268 269  bb.4:270    liveins: $r0271 272    $r1 = tMOVSr killed $r0, implicit-def dead $cpsr273    tB %bb.28, 14, $noreg274 275  bb.25.sw.bb106:276    renamable $r1, dead $cpsr = tMOVi8 11, 14, $noreg277    tB %bb.28, 14, $noreg278 279  bb.23.sw.bb97:280    renamable $r1, dead $cpsr = tMOVi8 8, 14, $noreg281    tB %bb.28, 14, $noreg282 283  bb.27.sw.bb91:284    liveins: $r4285 286    renamable $r0, dead $cpsr = tMOVi8 1, 14, $noreg287    tSTRi killed renamable $r0, killed renamable $r4, 0, 14, $noreg :: (store (s32) into %ir.ignore_ptr)288    renamable $r1, dead $cpsr = tMOVi8 0, 14, $noreg289    tB %bb.28, 14, $noreg290 291  bb.21.sw.bb95:292    renamable $r1, dead $cpsr = tMOVi8 13, 14, $noreg293    tB %bb.28, 14, $noreg294 295  bb.20.sw.bb94:296    renamable $r1, dead $cpsr = tMOVi8 9, 14, $noreg297    tB %bb.28, 14, $noreg298 299  bb.5.entry:300    liveins: $r0, $r1301 302    tCMPi8 killed renamable $r1, 39, 14, $noreg, implicit-def $cpsr303    tB %bb.6, 14, $noreg304 305  bb.11.entry:306    successors: %bb.12(0x80000000), %bb.26(0x00000000)307    liveins: $r0, $r1308 309    tCMPi8 killed renamable $r1, 69, 14, $noreg, implicit-def $cpsr310    tBcc %bb.26, 1, killed $cpsr311 312  bb.12.sw.bb107:313    successors: %bb.28(0x7fffffff), %bb.13(0x00000001)314    liveins: $r0315 316    renamable $r1, dead $cpsr = tMOVi8 27, 14, $noreg317    renamable $r2, dead $cpsr = tMOVi8 0, 14, $noreg318    tCMPi8 killed renamable $r2, 0, 14, $noreg, implicit-def $cpsr319    tBcc %bb.28, 1, killed $cpsr320 321  bb.13.if.then109:322    successors:323    liveins: $r0324 325    $r1 = tMOVSr killed $r0, implicit-def dead $cpsr326    tBL 14, $noreg, @foo1, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit undef $r0, implicit $r1, implicit-def $sp, implicit-def dead $r0327 328  bb.8.entry:329    liveins: $r0, $r1330 331    tCMPi8 killed renamable $r1, 63, 14, $noreg, implicit-def $cpsr332 333  bb.6.entry:334    successors: %bb.28(0x80000000), %bb.26(0x00000000)335    liveins: $cpsr, $r0336 337    tPUSH 14, $noreg, killed $r0, implicit-def $sp, implicit $sp338    tPOP 14, $noreg, def $r1, implicit-def $sp, implicit $sp339    tBcc %bb.28, 0, killed $cpsr340 341  bb.26.sw.epilog:342    successors:343 344 345  bb.22.sw.bb96:346    renamable $r1, dead $cpsr = tMOVi8 12, 14, $noreg347 348  bb.28.cleanup:349    liveins: $r1350 351    $r0 = tMOVSr killed $r1, implicit-def dead $cpsr352    tPOP_RET 14, $noreg, def $r4, def $pc, implicit-def $sp, implicit $sp, implicit $r0353 354  bb.18.while.end88:355    liveins: $r0356 357    tBL 14, $noreg, @foo2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp, implicit-def dead $r0358 359...360