This is the mail archive of the gcc-bugs@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]

[Bug middle-end/38204] PRE for post dominating expressions



------- Comment #2 from dberlin at gcc dot gnu dot org  2008-11-21 16:55 -------
(In reply to comment #0)
> For this function:
> int test (int a, int b, int c, int g)
> {
>   int d, e;
>   if (a)
>     d = b * c;
>   else
>     d = b - c;
>   e = b * c + g;
>   return d + e;
> }
> 
> the multiply expression is moved to both branches of the "if", it would be
> better to move it before the "if".  Intel's compiler does that.
> 

Moving it before the if is a code size optimization that also happens to extend
the lifetime of the multiply.
So "better" is a relative term.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38204


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