On Thu, 20 Jan 2005, Zdenek Dvorak wrote:
The right fix seems to be to add the second SRA pass in the middle of loop
optimizations (just immediately after cunroll). You would also need to
schedule constant propagation pass there (which should just work)
and preferably also cfg_cleanup (the variation from tcb branch that
preserves loop structures).
Yes, I tried this - actually just adding SRA and redphi after cunroll,
but this caused verify failures about not the right ssa form or so. So
I guessed SRA may be not ready to preserve invariants the loop
optimizers need.
you probably need to rerun the loop closed ssa form creation afterwards
(rewrite_into_loop_closed_ssa).
Ok, tried this again (see proof of concept patch below). With
-O2 -funroll-loops this solves the original testcase of PR18754,
but fails on the C++ testcase verifying the ssa form:
scalar_loops.cpp: In function 'void foo(const Array<2>&, const
Array<2>&)':
scalar_loops.cpp:32: internal compiler error: tree check: expected
ssa_name, have var_decl in verify_ssa, at tree-ssa.c:690
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Any ideas what is going wrong? This doesn't change, if I remove
the rename_ssa_copies() call.
Thanks,
Richard.