MaxNode::signed_min() always returns nullptr, instead of the expected MinI node, when the type of a and b is int. This is caused by an accidental redefinition of 'res' in the MaxNode::build_min_max() function that implements MaxNode::signed_min():
Node* MaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, ...) {
bool is_int = gvn.type(a)->isa_int();
(...)
Node* res = nullptr;
if (is_int && !is_unsigned) {
if (is_max) {
(...)
} else {
Node* res = gvn.transform(new MinINode(a, b));
(...)
}
} else {
(...)
}
(...)
return res;
}
The bug has not surfaced yet because the code is unreachable: the only current calls to MaxNode::signed_min() (from PhaseIdealLoop::clamp() and PhaseMacroExpand::expand_macro_nodes()) are for long arguments.