From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31891 invoked by alias); 28 Apr 2014 09:49:37 -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 31840 invoked by uid 48); 28 Apr 2014 09:49:33 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/60973] Invalid propagation of a tail call in devirt pass Date: Mon, 28 Apr 2014 09:49: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: rguenth at gcc dot gnu.org 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: keywords cf_gcctarget cc component short_desc 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-04/txt/msg02061.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60973 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Target| |h8300-elf CC| |hubicka at gcc dot gnu.org, | |jamborm at gcc dot gnu.org Component|tree-optimization |ipa Summary|Invalid propagation of a |Invalid propagation of a |tail call in copyrename2 |tail call in devirt pass |pass | --- Comment #1 from Richard Biener --- It's not copyrename (that's just the first dump you see it) but inlining. Inlining probably needs to clear [tailcall] from all inlined stmts unless it wants to prove the tailcall is still possible. Thus, Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 209782) +++ gcc/tree-inline.c (working copy) @@ -1485,6 +1489,11 @@ remap_gimple_stmt (gimple stmt, copy_bod /* Create a new deep copy of the statement. */ copy = gimple_copy (stmt); + /* Clear flags that need revisiting. */ + if (is_gimple_call (copy) + && gimple_call_tail_p (copy)) + gimple_call_set_tail (copy, false); + /* Remap the region numbers for __builtin_eh_{pointer,filter}, RESX and EH_DISPATCH. */ if (id->eh_map) not sure if GF_CALL_FROM_THUNK needs similar handling. The bug is probably not h8300-elf specific (but usually tailcall expansion fails as it re-checks the validity of the transform - and IIRC that is required, so it may even be a h8300-elf backend bug).