public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kazu at cs dot umass dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug optimization/15349] New: [tree-ssa] Merge two phi nodes. Date: Sun, 09 May 2004 19:48:00 -0000 [thread overview] Message-ID: <20040509194800.15349.kazu@cs.umass.edu> (raw) void bar (void); int foo (int a, int b) { int t; if (b) { if (a) t = 3; else t = 5; if (t) a++; } else t = 7; return t - 1; } I get: foo (a, b) { int t; <bb 0>: if (b_3 != 0) goto <L0>; else goto <L7>; <L0>:; if (a_6 != 0) goto <L1>; else goto <L3>; <L1>:; # t_1 = PHI <5(1), 3(2)>; <L3>:; # t_2 = PHI <7(0), t_1(3)>; <L7>:; return t_2 - 1; } Note that we can merge the first PHI into the second one like so: # t_2 = PHI <7(0), 5(1), 3(2)>; by replacing goto <L1>; with goto <L7>; Note that this optimization is pretty important because I see alias.c containing the following: <L191>:; # iftmp.1496_89 = PHI <0(139), 1(138)>; <L192>:; iftmp.1493_304 = iftmp.1496_89 != 0; # iftmp.1493_88 = PHI <iftmp.1493_304(140), iftmp.1493_316(136)>; <L193>:; if (iftmp.1493_88) goto <L194>; else goto <L202>; Once PR 14797 is solved, the above code should become something like <L191>:; # iftmp.1493_304 = PHI <0(139), 1(138)>; <L192>:; # iftmp.1493_88 = PHI <iftmp.1493_304(140), iftmp.1493_316(136)>; <L193>:; if (iftmp.1493_88) goto <L194>; else goto <L202>; Once this PR is solved, we would have <L192>:; # iftmp.1493_88 = PHI <0(139), 1(138), iftmp.1493_316(136)>; <L193>:; if (iftmp.1493_88) goto <L194>; else goto <L202>; Now it's trivial to redirect jumps from bb 139 and bb 138 to <L202> and <L194>, respectively, provided that nobody else uses iftmp.1493_88. -- Summary: [tree-ssa] Merge two phi nodes. Product: gcc Version: tree-ssa Status: UNCONFIRMED Keywords: pessimizes-code Severity: enhancement Priority: P2 Component: optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at cs dot umass dot edu CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15349
next reply other threads:[~2004-05-09 19:48 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-05-09 19:48 kazu at cs dot umass dot edu [this message] 2004-05-09 20:36 ` [Bug optimization/15349] " pinskia at gcc dot gnu dot org 2004-05-21 13:32 ` [Bug tree-optimization/15349] " dnovillo at gcc dot gnu dot org 2004-05-25 0:11 ` pinskia at gcc dot gnu dot org 2004-09-14 2:55 ` pinskia at gcc dot gnu dot org 2004-09-14 3:53 ` kazu at cs dot umass dot edu 2004-09-19 19:03 ` kazu at cs dot umass dot edu 2004-09-20 20:08 ` kazu at cs dot umass dot edu 2004-12-22 4:59 ` kazu at cs dot umass dot edu 2005-01-20 19:21 ` cvs-commit at gcc dot gnu dot org 2005-01-20 19:49 ` kazu at cs dot umass dot edu 2005-01-20 21:10 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040509194800.15349.kazu@cs.umass.edu \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).