1 ; REQUIRES: asserts 2 ; RUN: llc < %s -mtriple=thumbv7-apple-ios -arm-atomic-cfg-tidy=0 -stats 2>&1 | FileCheck %s 3 4 ; If ARMBaseInstrInfo::AnalyzeBlocks returns the wrong value, which was possible 5 ; for blocks with indirect branches, the IfConverter could end up deleting 6 ; blocks that were the destinations of indirect branches, leaving branches to 7 ; nowhere. 8 ; <rdar://problem/14464830> 9 10 define i32 @preserve_blocks(i32 %x) { 11 ; preserve_blocks: 12 ; CHECK: Block address taken 13 ; CHECK: %ibt1 14 ; CHECK: movs r0, #2 15 ; CHECK: Block address taken 16 ; CHECK: %ibt2 17 ; CHECK: movs r0, #1 18 ; CHECK-NOT: Address of block that was removed by CodeGen 19 20 ; Separate bug. There are no valid diamonds to if-convert in this file. 21 ; There was a bug in the if-conversion code that would if-convert a false 22 ; diamond where one side had a return and the other had an indirect branch. 23 ; Make sure no diamond conversions occurred while compiling this file. 24 ; CHECK: Statistics Collected 25 ; CHECK-NOT: 1 ifcvt - Number of diamond if-conversions performed 26 entry: 27 %c2 = icmp slt i32 %x, 3 28 %blockaddr = select i1 %c2, i8* blockaddress(@preserve_blocks, %ibt1), i8* blockaddress(@preserve_blocks, %ibt2) 29 %c1 = icmp eq i32 %x, 0 30 br i1 %c1, label %pre_ib, label %nextblock 31 32 nextblock: 33 ret i32 3 34 35 ibt1: 36 ret i32 2 37 38 ibt2: 39 ret i32 1 40 41 pre_ib: 42 indirectbr i8* %blockaddr, [ label %ibt1, label %ibt2 ] 43 } 44