# HG changeset patch # User kvn # Date 1204340835 28800 # Node ID e2ae28d2ce9199511ce53d43d6a96b82775f3bbb # Parent 545c277a3ecfac51bff6f5eb6b02fc3fac712c3c 6667588: Don't generate duplicated CMP for float/double values Summary: float CMove generation add duplicated CMPF if there are more then one Move depending on the condition. Reviewed-by: jrose, never, rasbold diff -r 545c277a3ecf -r e2ae28d2ce91 src/share/vm/opto/loopopts.cpp --- a/src/share/vm/opto/loopopts.cpp Fri Feb 29 11:22:27 2008 -0800 +++ b/src/share/vm/opto/loopopts.cpp Fri Feb 29 19:07:15 2008 -0800 @@ -435,9 +435,11 @@ // Check profitability int cost = 0; + int phis = 0; for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { Node *out = region->fast_out(i); if( !out->is_Phi() ) continue; // Ignore other control edges, etc + phis++; PhiNode* phi = out->as_Phi(); switch (phi->type()->basic_type()) { case T_LONG: @@ -489,6 +491,12 @@ } } if( cost >= ConditionalMoveLimit ) return NULL; // Too much goo + Node* bol = iff->in(1); + assert( bol->Opcode() == Op_Bool, "" ); + int cmp_op = bol->in(1)->Opcode(); + // It is expensive to generate flags from a float compare. + // Avoid duplicated float compare. + if( phis > 1 && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) return NULL; // -------------- // Now replace all Phis with CMOV's