This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is ccp_fold_builtin() for vs. fold_builtin_1() ?
- From: Diego Novillo <dnovillo at redhat dot com>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 31 Mar 2005 18:08:48 -0500
- Subject: Re: What is ccp_fold_builtin() for vs. fold_builtin_1() ?
- Organization: Red Hat Canada
- References: <200503312246.j2VMkeG4006877@caip.rutgers.edu>
On Thu, Mar 31, 2005 at 05:46:40PM -0500, Kaveh R. Ghazi wrote:
> And what is the place of fold_builtin_1() given we have
> ccp_fold_builtin() ?
>
> Would someone please enlighten me?
>
ccp_fold_builtin was mostly an attempt to enhance CCP so that we
could propagate constant string attributes from non constant
values. It uses a rudimentary use-def chain walker that will do
simple things like:
if (random ())
s_1 = "xxx";
else
s_2 = "yyy";
s_3 = PHI <s_1, s_2>
return strlen (s_3);
Even if the value of s_3 is non-constant, we know that
strlen(s_3) is always 3.
The implementation is very crude and primitive. A better
propagator that was able to handle other attributes could now be
implemented using the SSA propagation engine.
Interested? I never got around to fixing this wart.
Diego.