public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kazu@cs.umass.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/19791] New: [tcb] A constant not fully propagated Date: Sun, 06 Feb 2005 13:21:00 -0000 [thread overview] Message-ID: <20050206134041.19791.kazu@cs.umass.edu> (raw) Consider: extern void abort (void) __attribute__ ((__noreturn__)); extern int bar (int, int); int foo (int mode, int size, unsigned int align) { int align0; int iftmp1; if (mode == 0) { if (align != 128) abort (); } align0 = (int) align; if (mode == 0) { int D1131 = align0 / 8; int D1132 = D1131 + size; int D1133 = D1132 - 1; int D1134 = D1131 - 1; int D1135 = ~D1134; iftmp1 = D1133 & D1135; } else { iftmp1 = size; } return bar (iftmp1, align0); } Note that if we get to the basic block that starts with "int D1131", we know that align0 == 128, which can be propagated. The last tree SSA dump looks like so: foo (mode, size, align) { int prephitmp.1; int pretmp.0; int D1135; int D1134; int D1133; int D1132; int D1131; int iftmp1; int align0; int D.1134; int D.1133; <bb 0>: if (mode_4 == 0) goto <L0>; else goto <L10>; <L0>:; if (align_6 != 128) goto <L1>; else goto <L13>; <L1>:; abort (); <L10>:; align0_5 = (int) align_6; Invalid sum of outgoing probabilities 0.0% Invalid sum of incoming frequencies 5000, should be 0 # align0_2 = PHI <align0_5(3)>; <L2>:; Invalid sum of incoming frequencies 0, should be 9950 # align0_7 = PHI <align0_9(6), align0_2(4)>; # iftmp1_3 = PHI <iftmp1_18(6), size_11(4)>; <L6>:; D.1133_8 = bar (iftmp1_3, align0_7) [tail call]; return D.1133_8; Invalid sum of incoming frequencies 4950, should be 0 # align0_9 = PHI <128(1)>; <L13>:; D1131_13 = align0_9 / 8; D1132_14 = size_11 + D1131_13; D1133_15 = D1132_14 - 1; D1134_16 = D1131_13 - 1; D1135_17 = ~D1134_16; iftmp1_18 = D1133_15 & D1135_17; goto <bb 5> (<L6>); } Notice # align0_9 = PHI <128(1)>; which means we are missing the obvious constant propagation opportunity. This opportunity is picked up at the RTL level. On mainline, the opportunity is not as obvious, but the RTL optimizers do take care of this. -- Summary: [tcb] A constant not fully propagated Product: gcc Version: unknown Status: UNCONFIRMED Keywords: missed-optimization, TREE Severity: enhancement Priority: P2 Component: tree-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=19791
next reply other threads:[~2005-02-06 13:21 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-02-06 13:21 kazu@cs.umass.edu [this message] 2005-02-06 15:34 ` [Bug tree-optimization/19791] " kazu@cs.umass.edu 2005-02-06 16:17 ` pinskia@gcc.gnu.org 2005-05-06 8:39 ` steven at gcc dot gnu dot org 2005-05-06 14:02 ` 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=20050206134041.19791.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).