6667588: Don't generate duplicated CMP for float/double values

Fri, 29 Feb 2008 19:07:15 -0800

author
kvn
date
Fri, 29 Feb 2008 19:07:15 -0800
changeset 470
e2ae28d2ce91
parent 469
545c277a3ecf
child 471
f34d9da7acb2

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

src/share/vm/opto/loopopts.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/loopopts.cpp	Fri Feb 29 11:22:27 2008 -0800
     1.2 +++ b/src/share/vm/opto/loopopts.cpp	Fri Feb 29 19:07:15 2008 -0800
     1.3 @@ -435,9 +435,11 @@
     1.4  
     1.5    // Check profitability
     1.6    int cost = 0;
     1.7 +  int phis = 0;
     1.8    for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
     1.9      Node *out = region->fast_out(i);
    1.10      if( !out->is_Phi() ) continue; // Ignore other control edges, etc
    1.11 +    phis++;
    1.12      PhiNode* phi = out->as_Phi();
    1.13      switch (phi->type()->basic_type()) {
    1.14      case T_LONG:
    1.15 @@ -489,6 +491,12 @@
    1.16      }
    1.17    }
    1.18    if( cost >= ConditionalMoveLimit ) return NULL; // Too much goo
    1.19 +  Node* bol = iff->in(1);
    1.20 +  assert( bol->Opcode() == Op_Bool, "" );
    1.21 +  int cmp_op = bol->in(1)->Opcode();
    1.22 +  // It is expensive to generate flags from a float compare.
    1.23 +  // Avoid duplicated float compare.
    1.24 +  if( phis > 1 && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) return NULL;
    1.25  
    1.26    // --------------
    1.27    // Now replace all Phis with CMOV's

mercurial