This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/47413] Constant Propagation and Virtual Function Tables
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Jan 2011 11:36:15 +0000
- Subject: [Bug tree-optimization/47413] Constant Propagation and Virtual Function Tables
- Auto-submitted: auto-generated
- References: <bug-47413-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47413
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.01.25 11:35:50
CC| |rguenth at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-25 11:35:50 UTC ---
With GCC 4.6 I see
<bb 3>:
obj_11->vtab = &vtab1337;
D.3820_15 = f1337 (obj_11);
printf (&"%d\n"[0], D.3820_15);
so it calls f1337 directly, but it doesn't inline it.
We are partly confused by the CFG caused by the NULL test:
<bb 2>:
obj_11 = malloc (8);
if (obj_11 == 0B)
goto <bb 4>;
else
goto <bb 3>;
<bb 3>:
obj_11->vtab = &vtab1337;
<bb 4>:
# obj_12 = PHI <0B(2), obj_11(3)>
if (obj_12 == 0B)
goto <bb 6>;
else
goto <bb 5>;
<bb 5>:
D.3822_13 = obj_12->vtab;
D.3821_14 = D.3822_13->f;
D.3820_15 = D.3821_14 (obj_12);
so it takes several iterations through different optimizers to eventually
constant propagate the function address (jump-threading the test in BB4,
which only happens late by DOM).