[PATCH]: Remove some unnecessary types_compatible_p calls

Daniel Berlin dberlin@dberlin.org
Fri Apr 6 18:12:00 GMT 2007


The attached removes some unnecessary calls to types_compatible_p.

In particular, these are all places where it checks whether the types
are compatible before calling fold_convert (or doing what fold_convert
would do).  However, there is no need, as fold_convert already checks
whether it has work to do before doing anything.  In particular, at
best this may generate a few more temporary casts that should be
folded anyway before it returns.   At worst, the code that was there
before was wrong, because if we can't eliminate the conversion through
fold_convert, we probably needed it in the first place, or
fold_convert needs to be improved.

Bootstrapped and regtested on i686-pc-linux-gnu and i686-darwin.
Okay for mainline?

2007-04-06  Daniel Berlin  <dberlin@dberlin.org>

        * tree-ssa-dom.c (cprop_operand): Don't call types_compatible_p,
        just use fold_convert.
        * tree-vect-generic.c (expand_vector_operation): Ditto.
        * tree-ssa-phiopt.c (conditional_replacement):  Ditto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: removetypecompat.diff
Type: text/x-diff
Size: 2225 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070406/4e5e7516/attachment.bin>


More information about the Gcc-patches mailing list