This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: check_dbra_loop
- To: mark at codesourcery dot com
- Subject: Re: RFA: check_dbra_loop
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Sun, 13 May 01 09:21:10 EDT
- Cc: gcc at gcc dot gnu dot org
Now, it seems wrong on principle to me to try to ever base an
optimization on loop_invariant_p *not* holding, since that function is
conservative. We never know for sure that something is *not* loop
invariant; we only know that we cannot prove that it *is* loop
invariant.
Agreed.
(Furthermore, reversing a loop (in the naive way) seems bogus when
there is *any* write to global memory because a program can tell the
difference. For example, consider a threaded program, where another
thread is looking at the global continuously. It should see the
numbers count upwards, not downwards.
Is this required even if "volatile" is not specified?
So, I think this reversible_mem_store stuff is bogus, and that we are
not currently smart enough to reverse any loop that writes to memory.
I think we *can* reverse the loop if the address of the store is a giv since
then we know that each write is disjoint.