This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/52548] New: missed PRE optimization when function call follows to-be hoisted variable
- From: "aldyh at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Mar 2012 21:09:04 +0000
- Subject: [Bug middle-end/52548] New: missed PRE optimization when function call follows to-be hoisted variable
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52548
Bug #: 52548
Summary: missed PRE optimization when function call follows
to-be hoisted variable
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: aldyh@gcc.gnu.org
For the following code (for -O2):
int flag, hoist, y, z;
void
foo (void)
{
if (flag)
y = hoist + 4;
else
flag = 888;
z = hoist + 4;
bark ();
}
...PRE should be moving "hoist + 4" to the else arm, but it fails to do so.
If you remove the call to bark(), [hoist + 4] gets moved appropriately.
The bark() function call is in the same basic block as "z = hoist + 4". I wild
guess is that "hoist" isn't anticipatable at the *end* of the BB beginning with
"z = hoist + 4". Splitting BB's at function calls may improve PRE. Just a
guess...