https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85726
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Regressed with r218211 aka PR15346. Hans-Peter, are you still working on this or where the thread died? Do we want to do just something directed at this case, i.e. don't combine two divisions if the lhs of the first one is also used in a modulo with the same last operand as the second division and both are e.g. in the same bb? E.g. my PR82853 changes do something similar: imm_use_iterator imm_iter; use_operand_p use_p; FOR_EACH_IMM_USE_FAST (use_p, imm_iter, treeop0) { gimple *use_stmt = USE_STMT (use_p); /* Punt if treeop0 is used in the same bb in a division or another modulo with the same divisor. We should expect the division and modulo combined together. */ if (use_stmt == stmt || gimple_bb (use_stmt) != gimple_bb (stmt)) continue; if (!is_gimple_assign (use_stmt) || (gimple_assign_rhs_code (use_stmt) != TRUNC_DIV_EXPR && gimple_assign_rhs_code (use_stmt) != TRUNC_MOD_EXPR)) continue; if (gimple_assign_rhs1 (use_stmt) != treeop0 || !operand_equal_p (gimple_assign_rhs2 (use_stmt), treeop1, 0)) continue; return code; }