[Bug middle-end/64099] [5 Regression] ~15% runtime increase for fatigue.f90.

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 11 15:02:00 GMT 2014


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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
For r217826 vs. r217827 the assembly differences show a larger stack frame
while the optimized dump differences are net positive (more memory CSE happens
and loads get removed - which might increase register pressure enough).

For r216727 vs. r216728 the order of functions output changes, there are no
real changes in the optimized dumps.


Both rev. changes cause operand order to be swapped for some instructions
which can, given TER, result in significant scheduling differences in
the RTL expansion.


One thing is for example that the reassoc pass produces non-canonical
operand order but its operand order might be more optimal in practice
(the canonical order is just canonicalization for commutative operands).
As we deal with single-use chains there we might consider "swapping"
SSA names (swap SSA_NAME_VERSION) to preserve its ordering over a
fold_stmt call.  No, doing that doesn't make a significant difference :/
For reference:

Index: gcc/tree-ssa-reassoc.c
===================================================================
--- gcc/tree-ssa-reassoc.c      (revision 217827)
+++ gcc/tree-ssa-reassoc.c      (working copy)
@@ -3602,6 +3602,16 @@ rewrite_expr_tree (gimple stmt, unsigned
          update_stmt (stmt);
        }

+      if (commutative_tree_code (gimple_assign_rhs_code (stmt))
+         && tree_swap_operands_p (new_rhs1, oe->op, true))
+       {
+         gcc_assert (TREE_CODE (new_rhs1) == SSA_NAME
+                     && TREE_CODE (oe->op) == SSA_NAME);
+         std::swap (SSA_NAME_VERSION (new_rhs1), SSA_NAME_VERSION (oe->op));
+         std::swap (ssa_name (SSA_NAME_VERSION (new_rhs1)),
+                    ssa_name (SSA_NAME_VERSION (oe->op)));
+       }
+
       if (dump_file && (dump_flags & TDF_DETAILS))
        {
          fprintf (dump_file, " into ");



More information about the Gcc-bugs mailing list