[Bug tree-optimization/47413] Constant Propagation and Virtual Function Tables
hubicka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 26 17:07:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47413
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Current mainline gets pretty close:
;; Function int f1337(obj*) (_ZL5f1337P3obj, funcdef_no=19, decl_uid=3418,
cgraph_uid=19, symbol_order=19)
int f1337(obj*) (struct obj * obj)
{
<bb 2>:
return 1337;
}
;; Function int main() (main, funcdef_no=22, decl_uid=3427, cgraph_uid=22,
symbol_order=22) (executed once)
Removing basic block 5
int main() ()
{
struct obj * obj;
int _1;
int _10;
<bb 2>:
obj_7 = malloc (8);
if (obj_7 == 0B)
goto <bb 4>;
else
goto <bb 3>;
<bb 3>:
obj_7->vtab = &vtab1337;
_10 = f1337 (obj_7);
printf ("%d\n", _10);
<bb 4>:
# _1 = PHI <0(2), 1(3)>
return _1;
}
So we are down to one missing inline. After FRE we get:
<bb 2>:
obj_13 = malloc (8);
if (obj_13 == 0B)
goto <bb 4>;
else
goto <bb 3>;
<bb 3>:
obj_13->vtab = &vtab1337;
<bb 4>:
# _14 = PHI <0B(2), obj_13(3)>
if (_14 == 0B)
goto <bb 6>;
else
goto <bb 5>;
<bb 5>:
_4 = _14->vtab;
_15 = _4->f;
_16 = _15 (_14);
printf ("%d\n", _16);
So purely local problem. I suppose FRE could propagate through by knowing that
on the other path program with segfault?
More information about the Gcc-bugs
mailing list