During the CodeGenPrepare we often lower intrinsics (such as objsize)

and allow some optimizations to turn conditional branches into unconditional.
This commit adds a simple control-flow optimization which merges two consecutive
basic blocks which are connected by a single edge. This allows the codegen to
operate on larger basic blocks.

rdar://11973998



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nadav Rotem
2012-08-14 05:19:07 +00:00
parent 443c9ed768
commit 3e883734fa
8 changed files with 62 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ target triple = "x86_64-apple-darwin10.0.0"
; CHECK: @test1
; objectsize should fold to a constant, which causes the branch to fold to an
; uncond branch.
; uncond branch. Next, we fold the control flow alltogether.
; rdar://8785296
define i32 @test1(i8* %ptr) nounwind ssp noredzone align 2 {
entry:
@@ -13,8 +13,8 @@ entry:
%1 = icmp ugt i64 %0, 3
br i1 %1, label %T, label %trap
; CHECK: entry:
; CHECK-NEXT: br label %T
; CHECK: T:
; CHECK-NOT: br label %
trap: ; preds = %0, %entry
tail call void @llvm.trap() noreturn nounwind