This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/38204] PRE for post dominating expressions
- From: "dberlin at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2008 16:55:38 -0000
- Subject: [Bug middle-end/38204] PRE for post dominating expressions
- References: <bug-38204-1008@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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