On 06/19/2015 11:32 AM, Alan Lawrence wrote:
This is a respin of
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02139.html . Changes are:
* Separate the two passes by descending from a common base class,
allowing different predicates;
* Test flag_tree_vectorize, and loop->force_vectorize/dont_vectorize
- this fixes the test failing before;
* Simplify the check for "code after exit edge";
* Revert unnecessary changes to pass_tree_loop_init::execute;
* Revert change to slp-perm-7 test (following fix by Marc Glisse)
So FWIW, if you don't want to make this a separate pass, you'd probably
want the code which allows us to run the phi-only propagator as a
subroutine to propagate and eliminate those degenerate PHIs. I posted
it a year or two ago, but went a different direction to solve whatever
issue I was looking at.
I'm comfortable with this as a separate pass and relying on cfg cleanups
to handle this stuff for us as this implementation of your patch
currently does.
Bootstrapped + check-gcc on aarch64 and x86_64 (linux).
gcc/ChangeLog:
* tree-pass.h (make_pass_ch_vect): New.
* passes.def: Add pass_ch_vect just before pass_if_conversion.
* tree-ssa-loop-ch.c (pass_ch_base, pass_ch_vect, pass_data_ch_vect,
pass_ch::process_loop_p): New.
(pass_ch): Extend pass_ch_base.
(pass_ch::execute): Move all but loop_optimizer_init/finalize to...
(pass_ch_base::execute): ...here.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/vect-strided-a-u16-i4.c (main1): Narrow scope of
x,y,z,w.
of unsigned
* gcc.dg/vect/vect-ifcvt-11.c: New.
Can you add a function comment to ch_base::copy_headers. I know it
didn't have one before, but it really should have one.
I'd also add a comment to the execute methods. pass_ch initializes and
finalizes loop structures while pass_ch_vect::execute assumes the loop
structures are already initialized and finalization is assumed to be
handled earlier in the call chain.
I'd also suggest a comment to the process_loop_p method.
+
+ /* Apply copying if the exit block looks to have code after it. */
+ edge_iterator ei;
+ edge e;
+ FOR_EACH_EDGE (e, ei, exit->src->succs)
+ if (!loop_exit_edge_p (loop, e)
+ && e->dest != loop->header
+ && e->dest != loop->latch)
+ return true; /* Block with exit edge has code after it. */
Don't put comments on the same line as code. Instead I'd suggest
describing the CFG pattern your looking for as part of the comment
before the loop over the edges.
With those comment fixes, this is OK for the trunk.
jeff