http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60973

Richard Biener <rguenth at gcc dot gnu.org> 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 <rguenth at gcc dot gnu.org> ---
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).

Reply via email to