diff options
author | Chris Lattner <sabre@nondot.org> | 2005-08-21 17:41:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-08-21 17:41:11 +0000 |
commit | 4dd4a2d278ac65c871924bb5235805a6a07e3d69 (patch) | |
tree | 993f4411fff60ef0b873c9922f91510bdf20f20c /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 2cfd128becb373451405fc9838ed799e5012808f (diff) |
If the false value for a select_cc is really simple (has no inputs), evaluate
it in the block. This codegens:
int %test(bool %c) {
%retval = select bool %c, int 17, int 1
ret int %retval
}
as:
_test:
rlwinm r2, r3, 0, 31, 31
li r2, 17
cmpwi cr0, r3, 0
bne .LBB_test_2 ;
.LBB_test_1: ;
li r2, 1
.LBB_test_2: ;
or r3, r2, r2
blr
instead of:
_test:
rlwinm r2, r3, 0, 31, 31
li r2, 17
li r4, 1
cmpwi cr0, r3, 0
bne .LBB_test_2 ;
.LBB_test_1: ;
or r2, r4, r4
.LBB_test_2: ;
or r3, r2, r2
blr
... which is one fewer instruction. The savings are more significant for
global address and constantfp nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
0 files changed, 0 insertions, 0 deletions