8385855: C2: IfNode::filtered_int_type should only allow CmpI

Reviewed-by: qamai
Backport-of: 841e28822200103088c04d07b551537630ea79c4
This commit is contained in:
Emanuel Peter 2026-06-16 07:58:01 +00:00
parent b2b8de85d6
commit abccea5e2c
2 changed files with 1122 additions and 3 deletions

View File

@ -669,9 +669,11 @@ const TypeInt* IfNode::filtered_int_type(PhaseGVN* gvn, Node* val, Node* if_proj
BoolNode* bol = iff->in(1)->as_Bool();
if (bol->in(1) && bol->in(1)->is_Cmp()) {
const CmpNode* cmp = bol->in(1)->as_Cmp();
// Val is always the lhs of the comparision: val <test> cmp2
if (cmp->in(1) == val) {
assert(cmp->Opcode() == Op_CmpI, "signed comparison required");
// Val is always the lhs of the comparision: val CmpI cmp2
if (cmp->Opcode() == Op_CmpI && cmp->in(1) == val) {
// Only CmpI allowed, assumed by signed logic below.
// We could extend to CmpU in the future, and would
// have to implement unsigned range logic below.
const TypeInt* cmp2_t = gvn->type(cmp->in(2))->isa_int();
if (cmp2_t != nullptr) {
jint lo = cmp2_t->_lo;

File diff suppressed because it is too large Load Diff