diff options
| author | Philip Reames <listmail@philipreames.com> | 2015-03-10 22:52:37 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2015-03-10 22:52:37 +0000 |
| commit | 71c4035c18a9f008fd2b946c990f0da00754b1a5 (patch) | |
| tree | cad17f7cb50c9f6d561efe9d750af20157ec144a /llvm/test/Transforms | |
| parent | 857b4434df18a6ebcf26eebbb5daaace54b237a2 (diff) | |
| download | bcm5719-llvm-71c4035c18a9f008fd2b946c990f0da00754b1a5.tar.gz bcm5719-llvm-71c4035c18a9f008fd2b946c990f0da00754b1a5.zip | |
If a conditional branch jumps to the same target, remove the condition
Given that large parts of inst combine is restricted to instructions which have one use, getting rid of a use on the condition can help the effectiveness of the optimizer. Also, it allows the condition to potentially be deleted by instcombine rather than waiting for another pass.
I noticed this completely by accident in another test case. It's not anything that actually came from a real workload.
p.s. We should probably do the same thing for switch instructions.
Differential Revision: http://reviews.llvm.org/D8220
llvm-svn: 231881
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/branch.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/branch.ll b/llvm/test/Transforms/InstCombine/branch.ll new file mode 100644 index 00000000000..5be93cc2023 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/branch.ll @@ -0,0 +1,16 @@ +; RUN: opt -instcombine -S < %s | FileCheck %s + +define i32 @test(i32 %x) { +; CHECK-LABEL: @test +entry: +; CHECK-NOT: icmp +; CHECK: br i1 undef, + %cmp = icmp ult i32 %x, 7 + br i1 %cmp, label %merge, label %merge +merge: +; CHECK-LABEL: merge: +; CHECK: ret i32 %x + ret i32 %x +} + + |

