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