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] Temporary Expression Replacement in SSA->normal.


On Sat, 2003-12-13 at 09:39, Roger Sayle wrote:

> > This should be trivial for SSA CCP, no?  Which is again an argument
> > for doing these transformations while we still have SSA form
> > available.
> 
> I'll admit that I'm not sure.  If SSA CCP can optimize
> 
> T.1 = A + B
> T.2 = T.1 + C
> T.3 = T.2 + D
> T.4 = T.3 - A
> 
> then I'd be impressed.  It's not impossible, just that I don't think
> that deep reassociation is currently implemented.  I may be wrong.
> 
Assuming A, B, C and D are known constants, even the more
straightforward propagation done in DOM is able to convert bar() into
'return 9;'.  CCP is useful when you need to propagate constants through
PHIs and linearize control flow.

static int foo (int A, int B, int C, int D)
{
  return (((A + B) + C) + D) - A;
}
 
int bar ()
{
  return foo (1, 2, 3, 4);
}

Otherwise, we don't do any reassociation yet.


Diego.


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