blob: 1d8a24577f0aa37acbe0b56d3f6a749286f04f1d [file] [log] [blame]
Kyle Butt90e51b12016-08-25 00:06:52 +00001; REQUIRES: asserts
Kyle Butt6262ca32016-08-24 21:34:24 +00002; RUN: llc < %s -mtriple=thumbv7-apple-ios -arm-atomic-cfg-tidy=0 -stats 2>&1 | FileCheck %s
Lang Hames24864fe2013-07-19 23:52:47 +00003
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
10define i32 @preserve_blocks(i32 %x) {
11; preserve_blocks:
12; CHECK: Block address taken
Lang Hames24864fe2013-07-19 23:52:47 +000013; CHECK: movs r0, #1
Kyle Butt6262ca32016-08-24 21:34:24 +000014; CHECK: Block address taken
15; CHECK: movs r0, #2
Lang Hames24864fe2013-07-19 23:52:47 +000016; CHECK-NOT: Address of block that was removed by CodeGen
Kyle Butt6262ca32016-08-24 21:34:24 +000017
18; Separate bug. There are no valid diamonds to if-convert in this file.
19; There was a bug in the if-conversion code that would if-convert a false
20; diamond where one side had a return and the other had an indirect branch.
21; Make sure no diamond conversions occurred while compiling this file.
22; CHECK: Statistics Collected
23; CHECK-NOT: 1 ifcvt - Number of diamond if-conversions performed
Lang Hames24864fe2013-07-19 23:52:47 +000024entry:
25 %c2 = icmp slt i32 %x, 3
26 %blockaddr = select i1 %c2, i8* blockaddress(@preserve_blocks, %ibt1), i8* blockaddress(@preserve_blocks, %ibt2)
27 %c1 = icmp eq i32 %x, 0
28 br i1 %c1, label %pre_ib, label %nextblock
29
30nextblock:
31 ret i32 3
32
33ibt1:
34 ret i32 2
35
36ibt2:
37 ret i32 1
38
39pre_ib:
40 indirectbr i8* %blockaddr, [ label %ibt1, label %ibt2 ]
41}