diff options
author | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2016-08-16 19:50:33 +0000 |
---|---|---|
committer | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2016-08-16 19:50:33 +0000 |
commit | 15c81b05eae34320f69ea718abf0ff66192249c4 (patch) | |
tree | d4174272d7c216adb2df01e4069f80bbae669a14 /llvm/test/CodeGen/X86 | |
parent | d46a59fac45931bf3ea5b55246ac64654090901a (diff) | |
download | bcm5719-llvm-15c81b05eae34320f69ea718abf0ff66192249c4.tar.gz bcm5719-llvm-15c81b05eae34320f69ea718abf0ff66192249c4.zip |
[MBP] do not reorder and move up loop latch block
Do not reorder and move up a loop latch block before a loop header
when optimising for size because this will generate an extra
unconditional branch.
Differential Revision: https://reviews.llvm.org/D22521
llvm-svn: 278840
Diffstat (limited to 'llvm/test/CodeGen/X86')
-rw-r--r-- | llvm/test/CodeGen/X86/loop-blocks.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/loop-blocks.ll b/llvm/test/CodeGen/X86/loop-blocks.ll index 1a1d11e6cb3..fc6a357523f 100644 --- a/llvm/test/CodeGen/X86/loop-blocks.ll +++ b/llvm/test/CodeGen/X86/loop-blocks.ll @@ -228,6 +228,41 @@ done: ret void } +; This is exactly the same function as slightly_more_involved. +; The difference is that when optimising for size, we do not want +; to see this reordering. + +; CHECK-LABEL: slightly_more_involved_2: +; CHECK-NOT: jmp .LBB5_1 +; CHECK: .LBB5_1: +; CHECK-NEXT: callq body + +define void @slightly_more_involved_2() #0 { +entry: + br label %loop + +loop: + call void @body() + %t0 = call i32 @get() + %t1 = icmp slt i32 %t0, 2 + br i1 %t1, label %block_a, label %bb + +bb: + %t2 = call i32 @get() + %t3 = icmp slt i32 %t2, 99 + br i1 %t3, label %exit, label %loop + +block_a: + call void @bar99() + br label %loop + +exit: + call void @exit() + ret void +} + +attributes #0 = { minsize norecurse nounwind optsize readnone uwtable } + declare void @bar99() nounwind declare void @bar100() nounwind declare void @bar101() nounwind |