diff options
author | Chris Lattner <sabre@nondot.org> | 2005-08-08 05:28:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-08-08 05:28:22 +0000 |
commit | 010de25f42dabbb7e0a2fe8b42aecc4285362e0c (patch) | |
tree | 13ee2c5a8cd19811ff6abb3d6003fb2ba096b627 /lib/Support/CommandLine.cpp | |
parent | 0fe34d89126c594e0e8378d978a593350189fedf (diff) |
Implement a simple optimization for the termination condition of the loop.
The termination condition actually wants to use the post-incremented value
of the loop, not a new indvar with an unusual base.
On PPC, for example, this allows us to compile
LoopStrengthReduce/exit_compare_live_range.ll to:
_foo:
li r2, 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r2, r2, 1
cmpw cr0, r2, r4
bne .LBB_foo_1 ; no_exit
blr
instead of:
_foo:
li r2, 1 ;; IV starts at 1, not 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r5, r2, 1
cmpw cr0, r2, r4
or r2, r5, r5 ;; Reg-reg copy, extra live range
bne .LBB_foo_1 ; no_exit
blr
This implements LoopStrengthReduce/exit_compare_live_range.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions