src/share/vm/opto/connode.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/connode.cpp Wed Apr 29 10:32:35 2009
--- new/src/share/vm/opto/connode.cpp Wed Apr 29 10:32:35 2009
*** 117,129 ****
--- 117,152 ----
}
}
return NULL;
}
+ //-----------------------------is_float_or_double_zero-----------------------
+ // Helper function for is_cmove_id to find float or double constant 0.0
+ bool CMoveNode::is_float_or_double_zero(PhaseTransform* phase, Node *val) {
+ const Type* t = phase->type(val);
+ if (t == Type::TOP) return false;
+ const TypeF *tf = t->isa_float_constant();
+ if( tf != NULL && tf->_f==0.0)
+ return true;
+ const TypeD *td = t->isa_double_constant();
+ if( td != NULL && td->_d==0.0)
+ return true;
+
+ return false;
+ }
+
//------------------------------is_cmove_id------------------------------------
// Helper function to check for CMOVE identity. Shared with PhiNode::Identity
Node *CMoveNode::is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b ) {
+ // Give up this identity check if either "t" or "f" is 0.0 (or -0.0)
+ // For example, for (f==0.0)?0.0:f, and if f = -0.0, the result should be 0.0 instead of -0.0(f)
+ // NOTE: non-constant double or float may still turn out to be 0.0 (-0.0). However, it may be
+ // too expensive to disable this optimization for general cases.
+ if( is_float_or_double_zero(phase, t) ||
+ is_float_or_double_zero(phase, f) )
+ return NULL;
+
// Check for Cmp'ing and CMove'ing same values
if( (phase->eqv(cmp->in(1),f) &&
phase->eqv(cmp->in(2),t)) ||
// Swapped Cmp is OK
(phase->eqv(cmp->in(2),f) &&
src/share/vm/opto/connode.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File