https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105173
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- <bb 2> [local count: 1073741824]: i.0_1 = i; _2 = (_Decimal32) i.0_1; _12 = (_Decimal64) _2; _13 = (_Decimal64) d_8(D); _3 = _12 * _13; _4 = (_Decimal64) c_9(D); _5 = -_4; _6 = _3 * _5; d_10 = (_Decimal32) _6; _11 = (int) d_10; Transforming _12 = (_Decimal64) _2; into _14 = _12 * -1.0e+0; Transforming _3 = _12 * _13; into _15 = _14 * _4; Transforming _6 = _3 * _5; into _6 = _15 * _13; <bb 2> [local count: 1073741824]: i.0_1 = i; _2 = (_Decimal32) i.0_1; _14 = _12 * -1.0e+0; _12 = (_Decimal64) _2; _13 = (_Decimal64) d_8(D); _4 = (_Decimal64) c_9(D); _15 = _14 * _4; _6 = _15 * _13; d_10 = (_Decimal32) _6; _11 = (int) d_10; return _11; and the logic wrt gimple *insert_point = find_insert_point (stmt, oe1->op, oe2->op); ... if (insert_point == gsi_stmt (gsi)) gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); else insert_stmt_after (stmt, insert_point); does not work for (gdb) p debug_gimple_stmt (stmt) _12 = (_Decimal64) _2; $4 = void (gdb) p oe1->op $5 = <ssa_name 0x7ffff667e120 12> (gdb) p oe2->op $6 = <real_cst 0x7ffff6681540> testing a fix.