mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
indirect branches correctly. Under some circumstances, this led to the deletion of basic blocks that were the destination of indirect branches. In that case it left indirect branches to nowhere in the code. This patch replaces, and is more general than either of the previous fixes for indirect-branch-analysis issues, r181161 and r186461. For other branches (not indirect) this refactor should have *almost* identical behavior to the previous version. There are some corner cases where this refactor is able to analyze blocks that the previous version could not (e.g. this necessitated the update to thumb2-ifcvt2.ll). <rdar://problem/14464830> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186735 91177308-0d34-0410-b5e6-96231b3b80d8
33 lines
870 B
LLVM
33 lines
870 B
LLVM
; RUN: llc < %s -mtriple=thumbv7-apple-ios | FileCheck %s
|
|
|
|
; If ARMBaseInstrInfo::AnalyzeBlocks returns the wrong value, which was possible
|
|
; for blocks with indirect branches, the IfConverter could end up deleting
|
|
; blocks that were the destinations of indirect branches, leaving branches to
|
|
; nowhere.
|
|
; <rdar://problem/14464830>
|
|
|
|
define i32 @preserve_blocks(i32 %x) {
|
|
; preserve_blocks:
|
|
; CHECK: Block address taken
|
|
; CHECK: movs r0, #2
|
|
; CHECK: movs r0, #1
|
|
; CHECK-NOT: Address of block that was removed by CodeGen
|
|
entry:
|
|
%c2 = icmp slt i32 %x, 3
|
|
%blockaddr = select i1 %c2, i8* blockaddress(@preserve_blocks, %ibt1), i8* blockaddress(@preserve_blocks, %ibt2)
|
|
%c1 = icmp eq i32 %x, 0
|
|
br i1 %c1, label %pre_ib, label %nextblock
|
|
|
|
nextblock:
|
|
ret i32 3
|
|
|
|
ibt1:
|
|
ret i32 2
|
|
|
|
ibt2:
|
|
ret i32 1
|
|
|
|
pre_ib:
|
|
indirectbr i8* %blockaddr, [ label %ibt1, label %ibt2 ]
|
|
}
|