[Bug middle-end/52548] New: missed PRE optimization when function call follows to-be hoisted variable
aldyh at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 9 21:09:00 GMT 2012
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...
More information about the Gcc-bugs
mailing list