Add a peephole optimization to optimize pairs of bitcasts. e.g.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 15 Mar 2011 05:13:13 +0000 (05:13 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 15 Mar 2011 05:13:13 +0000 (05:13 +0000)
commitd158fba3e45547f013bbab4c0ac640f31b5e341f
tree4d17e2c074387dfc8b8eb7ae78759f49103cbcce
parent0f040a258ff6a2372fc232212b5e4189e8e7185d
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
lib/CodeGen/PeepholeOptimizer.cpp
test/CodeGen/ARM/peephole-bitcast.ll [new file with mode: 0644]