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

@@ -10,10 +10,10 @@
%struct.indexentry = type { i32, i8*, i8*, i8*, i8*, i8* }
define i32 @_bfd_stab_section_find_nearest_line(i32 %offset) nounwind {
define i32 @_bfd_stab_section_find_nearest_line(i32 %offset, i1 %cond) nounwind {
entry:
%tmp910 = add i32 0, %offset ; <i32> [#uses=1]
br i1 true, label %bb951, label %bb917
br i1 %cond, label %bb951, label %bb917
bb917: ; preds = %entry
ret i32 0
@@ -21,7 +21,7 @@ bb917: ; preds = %entry
bb951: ; preds = %bb986, %entry
%tmp955 = sdiv i32 0, 2 ; <i32> [#uses=3]
%tmp961 = getelementptr %struct.indexentry* null, i32 %tmp955, i32 0 ; <i32*> [#uses=1]
br i1 true, label %bb986, label %bb967
br i1 %cond, label %bb986, label %bb967
bb967: ; preds = %bb951
ret i32 0