提交 5d84c71f 编写于 作者: K kvn

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
上级 a0a4f015
...@@ -435,9 +435,11 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) { ...@@ -435,9 +435,11 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
// Check profitability // Check profitability
int cost = 0; int cost = 0;
int phis = 0;
for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
Node *out = region->fast_out(i); Node *out = region->fast_out(i);
if( !out->is_Phi() ) continue; // Ignore other control edges, etc if( !out->is_Phi() ) continue; // Ignore other control edges, etc
phis++;
PhiNode* phi = out->as_Phi(); PhiNode* phi = out->as_Phi();
switch (phi->type()->basic_type()) { switch (phi->type()->basic_type()) {
case T_LONG: case T_LONG:
...@@ -489,6 +491,12 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) { ...@@ -489,6 +491,12 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
} }
} }
if( cost >= ConditionalMoveLimit ) return NULL; // Too much goo 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 // Now replace all Phis with CMOV's
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册