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: [PATCH] CSE some calls to compare_values


On Sun, 7 Jan 2007, Richard Guenther wrote:

> > Wouldn't it be more natural to apply atttribute const or pure to
> > compare_values() and let the optimizer to this for you (everywhere)?
>
> Well, we'd lie to the compiler as compare_values has side-effects.  It
> shouldn't break anything but I remember we concluded not to like it.
> (We could also "safely" mark build_int_cst pure for example)
> Richard.

Yeah, compare_values calls some fold_* stuff and also gcc_assert and
gcc_unreachable which are definitely side-effecters.

Maybe a new attribute, e.g. "cse" (pick what you like), would let us tell
the compiler it could remove duplicate calls without other opts like
hoisting or whatever it is that makes us lie.  We could design this
attribute to not care about noreturn calls or malloc'ing.

What are the various optimizations the compiler can do when it sees a
const or pure function?  Knowing that would help us design one or more
attributes that let us go halfsay without lying to the compiler.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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