Hi All, I did all changes proposed by Richard and delete check on def in the same block as Jakub proposed. I also moved check on optimization to call site.. I also checked that bootstrap and regression testing did not show any new failures. Is it OK for trunk? 2015-01-14 14:02 GMT+03:00 Jakub Jelinek : > On Wed, Jan 14, 2015 at 11:58:50AM +0100, Richard Biener wrote: >> >> + /* Swap operands if the second one is more expensive. */ >> >> + def0 = get_gimple_for_ssa_name (op0); >> >> + if (!def0) >> >> + continue; >> >> + def1 = get_gimple_for_ssa_name (op1); >> >> + if (!def1) >> >> + continue; >> >> + swap = false; >> > >> > You don't check here if def0/def1 are from the same bb, is that guaranteed? >> >> I think so - we only TER inside BBs. > > But then why to check for it a few lines above: > > + def_stmt = get_gimple_for_ssa_name (use); > + if (!def_stmt || gimple_bb (def_stmt) != bb) > > If get_gimple_for_ssa_name != NULL guarantees that gimple_bb of the result == bb, then > even the || gimple_bb (def_stmt) != bb shouldn't be needed. > > Jakub