From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22838 invoked by alias); 9 May 2014 14:27:01 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 22775 invoked by uid 55); 9 May 2014 14:26:57 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/60973] Invalid propagation of a tail call in devirt pass Date: Fri, 09 May 2014 14:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00821.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60973 --- Comment #5 from Jan Hubicka --- > Before tunks we never bothered to compute [tailcall] before inlining > completed, but now explicitely setting the flag for thunks (and not letting > it be computed - why wouldn't that work?) breaks this. > > So not setting the flag explicitely in expand_thunk looks like a better fix > to me? We always had this explicit set of tailcall in thunk expansion code - originally in C++ frontend and at early LTO times I just literaly moved it to cgraphunit. This patch http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01035.html makes it possible that tunks are inlined since we lower them to gimple bodies early and it is why things breaks now as inliner does not expect it. My initial reaction (written in previously comment) was also that tailcall should discover the flags themself and we could avoid setting them in the thunk expansion. Sadly I think it is not quite the case; tailcall is very conservative and I believe it will give up in cases where thunks are possible. Also it is not run at -O0 and for thunks we want the tailcall to happen since it only improves debugging exprience and saves codegen time... So I would probably say we should fix that in tree-inline as your patch propose.