This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Work around for an unfortunate fold-const vs.tree-optimizer interaction


On Thu, 6 Nov 2003, Diego Novillo wrote:
> I'm not sure we want to be turning off folders blindly, though.  We need
> a way of disabling some of these folders.  Jason suggested on IRC that
> we could add a tree peephole pass at the end of the main optimization
> sequence that would catch these cases.
>
> That would mean separating the obfuscating folders and make them
> optional, or something.  I'd like Roger or Jeff Law to comment on
> this problem, since they're more familiar with the folders.

I'm pleased that you asked.  I was wondering whether there was already
a global variable, flag_preserve_gimple, or something that could be
used to inform fold-const.c which pass it was in, and whether things
should be kept in gimble (or as above, just less obfuscated).

>From the middle-end perspective, its reasonable to disable many of
the problematic transformations during the tree-ssa passes, as long
as they are available to front-ends during parsing and then again
during RTL expansion.  We don't really need a tree-peephole pass as
the RTL expanders for problematic nodes, could call fold themselves.
A good example is optimizations that introduce new SAVE_EXPR nodes,
which can/should/must be disabled during the tree-ssa passes.

Indeed the only remaining reason for the duplication between fold_builtin
(and all of its fold_builtin_foo children) and simplify_builtin (and all
simplify_builtin_foo children) is that fold_builtin_cabs may introduce
new SAVE_EXPRs to evaluate "sqrt(x*x + y*y)".  If the tree-ssa branch
or the corresponding front-ends could signal which phase of compilation
they were in, we can avoid introducing SAVE_EXPRs, BITFIELD_REFs, etc...
expand_builtin_cabs can call fold_builtin_cabs to recapture this
optimization.

If someone could provide a patch to introduce this global variable
and set it appropriately in toplev.c, I'd be happy to make the
corresponding changes to fold and friends.

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]