Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc < %s -mtriple=thumbv7-apple-ios | FileCheck %s
      2 
      3 ; If ARMBaseInstrInfo::AnalyzeBlocks returns the wrong value, which was possible
      4 ; for blocks with indirect branches, the IfConverter could end up deleting
      5 ; blocks that were the destinations of indirect branches, leaving branches to
      6 ; nowhere.
      7 ; <rdar://problem/14464830>
      8 
      9 define i32 @preserve_blocks(i32 %x) {
     10 ; preserve_blocks:
     11 ; CHECK: Block address taken
     12 ; CHECK: movs r0, #2
     13 ; CHECK: movs r0, #1
     14 ; CHECK-NOT: Address of block that was removed by CodeGen
     15 entry:
     16   %c2 = icmp slt i32 %x, 3
     17   %blockaddr = select i1 %c2, i8* blockaddress(@preserve_blocks, %ibt1), i8* blockaddress(@preserve_blocks, %ibt2)
     18   %c1 = icmp eq i32 %x, 0
     19   br i1 %c1, label %pre_ib, label %nextblock
     20 
     21 nextblock:
     22   ret i32 3
     23 
     24 ibt1:
     25   ret i32 2
     26 
     27 ibt2:
     28   ret i32 1
     29 
     30 pre_ib:
     31   indirectbr i8* %blockaddr, [ label %ibt1, label %ibt2 ]
     32 }
     33