[Bug tree-optimization/80492] [5/6/7 Regression] Wrong code when unrolling a loop with inline asm and local regs

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 25 08:11:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80492

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
I can fix it with

Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c  (revision 247095)
+++ gcc/tree-ssa-pre.c  (working copy)
@@ -4495,6 +4519,8 @@ eliminate_dom_walker::before_dom_childre
       if (gimple_assign_single_p (stmt)
          && !gimple_has_volatile_ops (stmt)
          && !is_gimple_reg (gimple_assign_lhs (stmt))
+         && !(TREE_CODE (gimple_assign_lhs (stmt)) == VAR_DECL
+              && DECL_HARD_REGISTER (gimple_assign_lhs (stmt)))
          && (TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
              || is_gimple_min_invariant (gimple_assign_rhs1 (stmt))))
        {

CSE is similarly guarded.

But I really wonder if it is ok to omit constraints from the asm marking
the register variable as changed.

This basically means we treat register vars as volatile (but we do not
mark them so in the IL!) with all optimization consequences this has.

Anyway.  Testing the above.


More information about the Gcc-bugs mailing list