This is the mail archive of the
mailing list for the GCC project.
[PATCH]: Fix a number of bad interactions with PRE
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Jan 2005 11:08:33 -0500 (EST)
- Subject: [PATCH]: Fix a number of bad interactions with PRE
This patch fixes a number of reported bad interactions with PRE.
1. PR tree-optimization/19624
2. Ulrich's report about induction variable causing bad performance
3. Dead code insertion causing problems for other passes (vectorizer in
This is an update of a previous patch that steven bosscher had requested i
submit for 4.0. Now that there are a number of reported performance
regressions by various people caused by these problems, i figured it was
probably important to try to fix this for 4.0.
The patch does 2 main things, and gains improvements in what it can
eliminate by side-effect. The main things are :
1. Stops PRE from making new induction variables
2. Removes insertions that were never used.
As a side effect, it now subsumes partial constant propagation and catches
a lot more eliminations, as the earlier patch had, but without causing any
always unprofitable wraparound variables to be created (it catches
roughly 3x as many cases as PRE used to, even though it now skips a large
number of the cases it was unprofitably eliminating before).
The patch may slow down PRE about .5%. This is just the constant
overhead of initializing the loop information. Once loop info is
shared/kept up to date, we shouldn't have this overhead.
OTOH, people have reported performance improvements on mgrid on x86, and
in other applications, using this patch.
I chose to add a small DCE on just the inserted instructions to PRE (it's
<100 lines of code), rather than run DCE after PRE because currently
1. This will break if-convert unless we commit another patch
2. DCE will call cleanup_tree_cfg, which will unsplit critical edges,
which may have a detrimental affect on the loop optimizers that i don't
want to play with at this stage of the game.
3. It's faster
I plan on removing this code and running DCE with approriate options not
to unsplit critical edges, etc, in 4.1.
I've added 3 new testcases, and this patch will cause vect-22, and
vect-85->vect-87 to now xpass, because the dead code is no longer
I'll wait a few days for comments before committing this patch.
Bootstrapped and regtested on i686-pc-linux-gnu.
Description: Text document