diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-03-15 05:13:13 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-03-15 05:13:13 +0000 |
commit | d158fba3e45547f013bbab4c0ac640f31b5e341f (patch) | |
tree | 4d17e2c074387dfc8b8eb7ae78759f49103cbcce /test/CodeGen/ARM | |
parent | 0f040a258ff6a2372fc232212b5e4189e8e7185d (diff) | |
download | external_llvm-d158fba3e45547f013bbab4c0ac640f31b5e341f.zip external_llvm-d158fba3e45547f013bbab4c0ac640f31b5e341f.tar.gz external_llvm-d158fba3e45547f013bbab4c0ac640f31b5e341f.tar.bz2 |
Add a peephole optimization to optimize pairs of bitcasts. e.g.
v2 = bitcast v1
...
v3 = bitcast v2
...
= v3
=>
v2 = bitcast v1
...
= v1
if v1 and v3 are of in the same register class.
bitcast between i32 and fp (and others) are often not nops since they
are in different register classes. These bitcast instructions are often
left because they are in different basic blocks and cannot be
eliminated by dag combine.
rdar://9104514
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM')
-rw-r--r-- | test/CodeGen/ARM/peephole-bitcast.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/peephole-bitcast.ll b/test/CodeGen/ARM/peephole-bitcast.ll new file mode 100644 index 0000000..8d95d75 --- /dev/null +++ b/test/CodeGen/ARM/peephole-bitcast.ll @@ -0,0 +1,23 @@ +; RUN: llc < %s -march=arm -mcpu=cortex-a8 | FileCheck %s + +; vmov s0, r0 + vmov r0, s0 should have been optimized away. +; rdar://9104514 + +define void @t(float %x) nounwind ssp { +entry: +; CHECK: t: +; CHECK-NOT: vmov +; CHECK: bl + %0 = bitcast float %x to i32 + %cmp = icmp ult i32 %0, 2139095039 + br i1 %cmp, label %if.then, label %if.end + +if.then: ; preds = %entry + tail call void @doSomething(float %x) nounwind + br label %if.end + +if.end: ; preds = %if.then, %entry + ret void +} + +declare void @doSomething(float) |