This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Removing useless/redundant "const" calls
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: law at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Jun 2003 09:15:10 -0700
- Subject: Re: [tree-ssa] Removing useless/redundant "const" calls
- References: <Pine.LNX.4.44.0306120833500.4105-100000@wotan.suse.de>
Michael Matz <matz@suse.de> writes:
> There is no reason to not also remove useless calls to "pure" functions.
> They too have by definition no side-effects. Sure, they can read global
> memory (and hence proving "redundant" is harder), but this isn't a
> side-effect in the sense that it prevents removal. So, shouldn't
> TREE_SIDE_EFFECTS also be cleared for pure functions?
This seems like an opportune moment to point out that calls to
noreturn functions shouldn't count as side effects when determining
whether functions are pure or const.
Example - if I have a square root function that starts with
if (arg < 0) abort ();
but has no other potential side effects, it should still be considered
const.
zw