This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/60973] Invalid propagation of a tail call in devirt pass
- From: "hubicka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 May 2014 11:28:12 +0000
- Subject: [Bug ipa/60973] Invalid propagation of a tail call in devirt pass
- Auto-submitted: auto-generated
- References: <bug-60973-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60973
--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I wonder if the tailcall flag can't be reliably set by tree-tailcall, but i
suppose we want tailcall in thunks even at -O0.
The patch seems fine to me.
Note that this is not ipa-devirt issue, just semi-latent bug, so this probably
should be backported to all release branches.
The effect of CALL_FROM_THUNK is the following:
/* If we're compiling a thunk, pass through invisible references
instead of making a copy. */
if (call_from_thunk_p
|| (callee_copies
&& !TREE_ADDRESSABLE (type)
&& (base = get_base_address (args[i].tree_value))
&& TREE_CODE (base) != SSA_NAME
&& (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
{
I am not really confident about this code, but I would say that if we inlined
the thunk itself, we still should have the copy around - at least I do not see
any code in tree-inline that would copy propagate this through.
So probably we do not need to make the another copy? This may be true in
general for all parameters passed by invisible references that was passed to
caller same way and caller does not modify them or use after the call. This
seems just special case of this optimization.