public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]: Fix missed PRE optimization discovered
@ 2008-10-16 23:29 Daniel Berlin
  2008-10-17 13:05 ` Andreas Schwab
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Berlin @ 2008-10-16 23:29 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

The attached fixes a missed optimization in PRE noticed by richard guenther.

We weren't caching phi translation results if they were constants,
which would cause us to fail to optimize things like:


int main(int argc)
{
int i;

if (argc)
  i = 5;
else
  i = 9;
 y = __builtin_pow(i, i);
 return y;
}

the result of phi translation would end up being constant, and we
would throw it away, which would cause us to assume phi translation
had failed.
Fixed by also adding constants to the phi translation table.
This is a regression from 4.3 for some cases, so i am committing it to mainline.

Bootstrapped and regtested on i686-darwin, committed.
2008-10-16  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-pre.c (phi_translate_set): Add constants to phi
	translation cache.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: premissed.diff --]
[-- Type: text/x-patch; name=premissed.diff, Size: 645 bytes --]

diff -r 2b8e288bbb69 gcc/tree-ssa-pre.c
--- a/gcc/tree-ssa-pre.c	Wed Oct 15 16:48:13 2008 +0000
+++ b/gcc/tree-ssa-pre.c	Thu Oct 16 18:22:34 2008 -0400
@@ -1745,9 +1745,8 @@
       pre_expr translated;
       translated = phi_translate (expr, set, NULL, pred, phiblock);
 
-      /* Don't add constants or empty translations to the cache, since
-	 we won't look them up that way, or use the result, anyway.  */
-      if (translated && !value_id_constant_p (get_expr_value_id (translated)))
+      /* Don't add empty translations to the cache  */
+      if (translated)
 	phi_trans_add (expr, translated, pred);
 
       if (translated != NULL)

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2008-11-06 13:36 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-16 23:29 [PATCH]: Fix missed PRE optimization discovered Daniel Berlin
2008-10-17 13:05 ` Andreas Schwab
2008-10-17 13:08   ` Eric Botcazou
2008-10-17 15:41     ` Daniel Berlin
2008-10-17 17:08       ` Daniel Berlin
2008-10-17 17:56         ` Daniel Berlin
2008-10-17 19:08         ` Eric Botcazou
2008-10-17 22:24           ` Daniel Berlin
2008-10-17 22:46           ` Laurent GUERBY
2008-10-18 10:28             ` Daniel Berlin
2008-10-18 18:03               ` Richard Guenther
2008-10-18 18:05                 ` Richard Guenther
2008-10-18 23:04                 ` Daniel Berlin
2008-10-19  4:23                   ` Richard Guenther
2008-10-20 20:23                     ` Daniel Berlin
2008-10-21 12:36                       ` Laurent GUERBY
2008-10-21 13:56                         ` Eric Botcazou
2008-10-21 14:08                           ` Laurent GUERBY
2008-10-21 14:23                             ` Andreas Schwab
2008-10-21 14:45                               ` Laurent GUERBY
2008-10-21 15:01                                 ` Andreas Schwab
2008-10-22 13:57                                   ` Laurent GUERBY
2008-10-22 14:04                                     ` Andreas Schwab
2008-10-22 14:40                                       ` Laurent GUERBY
2008-10-25 23:21                                       ` Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered) Laurent GUERBY
2008-10-26  0:17                                         ` Andreas Schwab
2008-10-26  0:33                                           ` Laurent GUERBY
2008-11-06 13:36                                             ` Laurent GUERBY
2008-11-06 14:03                                               ` Laurent GUERBY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).