1957 }
1958
1959 bool want_max = (id == vmIntrinsics::_max);
1960
1961 const TypeInt* txvalue = _gvn.type(xvalue)->isa_int();
1962 const TypeInt* tyvalue = _gvn.type(yvalue)->isa_int();
1963 if (txvalue == NULL || tyvalue == NULL) return top();
1964 // This is not really necessary, but it is consistent with a
1965 // hypothetical MaxINode::Value method:
1966 int widen = MAX2(txvalue->_widen, tyvalue->_widen);
1967
1968 // %%% This folding logic should (ideally) be in a different place.
1969 // Some should be inside IfNode, and there to be a more reliable
1970 // transformation of ?: style patterns into cmoves. We also want
1971 // more powerful optimizations around cmove and min/max.
1972
1973 // Try to find a dominating comparison of these guys.
1974 // It can simplify the index computation for Arrays.copyOf
1975 // and similar uses of System.arraycopy.
1976 // First, compute the normalized version of CmpI(x, y).
1977 int cmp_op = Op_CmpI;
1978 Node* xkey = xvalue;
1979 Node* ykey = yvalue;
1980 Node* ideal_cmpxy = _gvn.transform(new CmpINode(xkey, ykey));
1981 if (ideal_cmpxy->is_Cmp()) {
1982 // E.g., if we have CmpI(length - offset, count),
1983 // it might idealize to CmpI(length, count + offset)
1984 cmp_op = ideal_cmpxy->Opcode();
1985 xkey = ideal_cmpxy->in(1);
1986 ykey = ideal_cmpxy->in(2);
1987 }
1988
1989 // Start by locating any relevant comparisons.
1990 Node* start_from = (xkey->outcnt() < ykey->outcnt()) ? xkey : ykey;
1991 Node* cmpxy = NULL;
1992 Node* cmpyx = NULL;
1993 for (DUIterator_Fast kmax, k = start_from->fast_outs(kmax); k < kmax; k++) {
1994 Node* cmp = start_from->fast_out(k);
1995 if (cmp->outcnt() > 0 && // must have prior uses
1996 cmp->in(0) == NULL && // must be context-independent
1997 cmp->Opcode() == cmp_op) { // right kind of compare
|
1957 }
1958
1959 bool want_max = (id == vmIntrinsics::_max);
1960
1961 const TypeInt* txvalue = _gvn.type(xvalue)->isa_int();
1962 const TypeInt* tyvalue = _gvn.type(yvalue)->isa_int();
1963 if (txvalue == NULL || tyvalue == NULL) return top();
1964 // This is not really necessary, but it is consistent with a
1965 // hypothetical MaxINode::Value method:
1966 int widen = MAX2(txvalue->_widen, tyvalue->_widen);
1967
1968 // %%% This folding logic should (ideally) be in a different place.
1969 // Some should be inside IfNode, and there to be a more reliable
1970 // transformation of ?: style patterns into cmoves. We also want
1971 // more powerful optimizations around cmove and min/max.
1972
1973 // Try to find a dominating comparison of these guys.
1974 // It can simplify the index computation for Arrays.copyOf
1975 // and similar uses of System.arraycopy.
1976 // First, compute the normalized version of CmpI(x, y).
1977 uint cmp_op = Op_CmpI;
1978 Node* xkey = xvalue;
1979 Node* ykey = yvalue;
1980 Node* ideal_cmpxy = _gvn.transform(new CmpINode(xkey, ykey));
1981 if (ideal_cmpxy->is_Cmp()) {
1982 // E.g., if we have CmpI(length - offset, count),
1983 // it might idealize to CmpI(length, count + offset)
1984 cmp_op = ideal_cmpxy->Opcode();
1985 xkey = ideal_cmpxy->in(1);
1986 ykey = ideal_cmpxy->in(2);
1987 }
1988
1989 // Start by locating any relevant comparisons.
1990 Node* start_from = (xkey->outcnt() < ykey->outcnt()) ? xkey : ykey;
1991 Node* cmpxy = NULL;
1992 Node* cmpyx = NULL;
1993 for (DUIterator_Fast kmax, k = start_from->fast_outs(kmax); k < kmax; k++) {
1994 Node* cmp = start_from->fast_out(k);
1995 if (cmp->outcnt() > 0 && // must have prior uses
1996 cmp->in(0) == NULL && // must be context-independent
1997 cmp->Opcode() == cmp_op) { // right kind of compare
|