diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-03 14:35:47 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-03 14:35:47 +0000 |
commit | 2ad68de4aa879d4ebd2ddfc1943b06038e31552e (patch) | |
tree | 1a438fdb36f1de61c768dbdae0c825e46457de42 /llvm/test/CodeGen/X86/tail-opts.ll | |
parent | 73c8145505c2ff5898572fd56b74e6d1274609d9 (diff) | |
download | bcm5719-llvm-2ad68de4aa879d4ebd2ddfc1943b06038e31552e.tar.gz bcm5719-llvm-2ad68de4aa879d4ebd2ddfc1943b06038e31552e.zip |
Fix a bug which prevented tail merging of return instructions in
beneficial cases. See the changes in test/CodeGen/X86/tail-opts.ll and
test/CodeGen/ARM/ifcvt2.ll for details.
The fix is to change HashEndOfMBB to hash at most one instruction,
instead of trying to apply heuristics about when it will be profitable to
consider more than one instruction. The regular tail-merging heuristics
are already prepared to handle the same cases, and they're more precise.
Also, make test/CodeGen/ARM/ifcvt5.ll and
test/CodeGen/Thumb2/thumb2-branch.ll slightly more complex so that they
continue to test what they're intended to test.
And, this eliminates the problem in
test/CodeGen/Thumb2/2009-10-15-ITBlockBranch.ll, the testcase from
PR5204. Update it accordingly.
llvm-svn: 102907
Diffstat (limited to 'llvm/test/CodeGen/X86/tail-opts.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/tail-opts.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/tail-opts.ll b/llvm/test/CodeGen/X86/tail-opts.ll index 4d93bd719f7..9662ad6cd74 100644 --- a/llvm/test/CodeGen/X86/tail-opts.ll +++ b/llvm/test/CodeGen/X86/tail-opts.ll @@ -406,3 +406,26 @@ bb12: return: ret void } + +; Tail-merging should merge the two ret instructions since one side +; can fall-through into the ret and the other side has to branch anyway. + +; CHECK: TESTE: +; CHECK: imulq +; CHECK-NEXT: LBB8_2: +; CHECK-NEXT: ret + +define i64 @TESTE(i64 %parami, i64 %paraml) nounwind readnone { +entry: + %cmp = icmp slt i64 %parami, 1 ; <i1> [#uses=1] + %varx.0 = select i1 %cmp, i64 1, i64 %parami ; <i64> [#uses=1] + %cmp410 = icmp slt i64 %paraml, 1 ; <i1> [#uses=1] + br i1 %cmp410, label %for.end, label %bb.nph + +bb.nph: ; preds = %entry + %tmp15 = mul i64 %paraml, %parami ; <i64> [#uses=1] + ret i64 %tmp15 + +for.end: ; preds = %entry + ret i64 %varx.0 +} |