- DBG((dbg, LEVEL_5, "Applied: (%n .%s. %n) %n %n => (%n %n %n) .%s. (%n %n %n)\n",
- t1, get_op_name(op), t2, n, c, t1, n, c, get_op_name(op), t2, n, c));
- exchange(n, irn);
- *node = irn;
+ /* In some cases it might happen that the new irn is equal the old one, for
+ * instance in:
+ * (x - 1) * y == x * y - y
+ * will be transformed back by simpler optimization
+ * We could switch simple optimizations off, but this only happens iff y
+ * is a loop-invariant expression and that it is not clear if the new form
+ * is better.
+ * So, we let the old one.
+ */
+ if (irn != n) {
+ DBG((dbg, LEVEL_5, "Applied: (%n .%s. %n) %n %n => (%n %n %n) .%s. (%n %n %n)\n",
+ t1, get_op_name(op), t2, n, c, t1, n, c, get_op_name(op), t2, n, c));
+ exchange(n, irn);
+ *node = irn;