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

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to [email protected] from comment #11)
> side-note: re-assoc produces uncanonical operand oder here.

This seems to fix the uncanonical order in re-associatation:
```
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index c140f76766e..6e220e02ecd 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -5268,6 +5268,9 @@ rewrite_expr_tree (gimple *stmt, enum tree_code rhs_code,
unsigned int opindex,

       oe1 = ops[opindex];
       oe2 = ops[opindex + 1];
+      if (commutative_tree_code (rhs_code)
+         && tree_swap_operands_p (oe1->op, oe2->op))
+       std::swap (oe1, oe2);

       if (rhs1 != oe1->op || rhs2 != oe2->op)
        {

```

Reply via email to