diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-17 18:16:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-17 18:16:40 +0000 |
commit | bca3e297fe3bc2bceab41cb6d567c3d6fea31cb8 (patch) | |
tree | e7cf99979ad790bd11b157323dbab90542d66149 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | b7f67a23e0160398c075d500212690ba1e45f8da (diff) | |
download | bcm5719-llvm-bca3e297fe3bc2bceab41cb6d567c3d6fea31cb8.tar.gz bcm5719-llvm-bca3e297fe3bc2bceab41cb6d567c3d6fea31cb8.zip |
Enable deleting branches to successor blocks. With the previous patches,
branch folding can now compile stuff like this:
void foo(int W, int X, int Y, int Z) {
if (W & 1) {
for (; X;--X) bar();
} else if (W & 2) {
for (; Y;--Y) bar();
} else if (W & 4) {
for (; Z;--Z) bar();
} else if (W & 8) {
for (; W;--W) bar();
}
if (W) {
bar();
}
}
contrived testcase where loops exits all end up merging together. To have
the loop merges be:
...
cmplw cr0, r30, r27
bne cr0, LBB1_14 ;bb38
LBB1_16: ;cond_next48.loopexit
mr r27, r29
LBB1_20: ;cond_next48
cmplwi cr0, r27, 0
beq cr0, LBB1_22 ;UnifiedReturnBlock
...
instead of:
...
cmplw cr0, r30, r27
bne cr0, LBB1_14 ;bb38
LBB1_16: ;cond_next48.loopexit
mr r27, r29
b LBB1_20 ;cond_next48
LBB1_17: ;cond_next48.loopexit1
b LBB1_20 ;cond_next48
LBB1_18: ;cond_next48.loopexit2
b LBB1_20 ;cond_next48
LBB1_19: ;cond_next48.loopexit3
LBB1_20: ;cond_next48
cmplwi cr0, r27, 0
beq cr0, LBB1_22 ;UnifiedReturnBlock
...
This is CodeGen/PowerPC/branch-opt.ll
llvm-svn: 31006
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
0 files changed, 0 insertions, 0 deletions