diff options
author | dalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-16 17:13:34 +0000 |
---|---|---|
committer | dalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-16 17:13:34 +0000 |
commit | e0ca498088d19652d275a7994dc764fcab7b5f00 (patch) | |
tree | eac12c2a50a19fa9cba5bc97d3201615d9aeb226 /gcc/loop.c | |
parent | 73caa7eff77bd44542427ec32486e09bc1dc8fbe (diff) | |
download | gcc-e0ca498088d19652d275a7994dc764fcab7b5f00.tar.gz |
2004-06-16 Dale Johannesen <dalej@apple.com>
* loop.c (loop_givs_reduce): Avoid miscompilation of
loops entered at bottom.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83248 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop.c')
-rw-r--r-- | gcc/loop.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/loop.c b/gcc/loop.c index fd0c0d64354..aafb18c02f9 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -4699,13 +4699,24 @@ loop_givs_reduce (struct loop *loop, struct iv_class *bl) this is an address giv, then try to put the increment immediately after its use, so that flow can create an auto-increment addressing mode. */ + /* Don't do this for loops entered at the bottom, to avoid + this invalid transformation: + jmp L; -> jmp L; + TOP: TOP: + use giv use giv + L: inc giv + inc biv L: + test biv test giv + cbr TOP cbr TOP + */ if (v->giv_type == DEST_ADDR && bl->biv_count == 1 && bl->biv->always_executed && ! bl->biv->maybe_multiple /* We don't handle reversed biv's because bl->biv->insn does not have a valid INSN_LUID. */ && ! bl->reversed && v->always_executed && ! v->maybe_multiple - && INSN_UID (v->insn) < max_uid_for_loop) + && INSN_UID (v->insn) < max_uid_for_loop + && !loop->top) { /* If other giv's have been combined with this one, then this will work only if all uses of the other giv's occur |