fix limit type

This commit is contained in:
Kangcheng Xu 2026-03-27 00:01:36 -04:00
parent 165d788e11
commit 2b4c1252b8
2 changed files with 4 additions and 4 deletions

View File

@ -2361,7 +2361,7 @@ bool CountedLoopConverter::is_counted_loop() {
// there is no overflow of the iv phi after the first iteration. In this case, we don't need to check (ii)
// again and can skip the predicate.
const TypeInteger* limit_t = _structure.exit_test().limit_t(*igvn);
const TypeInteger* limit_t = _structure.exit_test().limit_t(*igvn, _iv_bt);
Node* raw_limit = _structure.exit_test().raw_limit();
StrideOverflowState stride_overflow_state = check_stride_overflow(_structure.final_limit_correction(), limit_t, _iv_bt);
@ -2496,7 +2496,7 @@ bool CountedLoopConverter::LoopStructure::is_infinite_loop() const {
PhaseIterGVN& igvn = _phase->igvn();
const TypeInteger* incr_t = igvn.type(_iv_incr.incr())->is_integer(_iv_bt);
const TypeInteger* limit_t = _exit_test.limit_t(igvn);
const TypeInteger* limit_t = _exit_test.limit_t(igvn, _iv_bt);
if (limit_t->hi_as_long() > incr_t->hi_as_long()) {
// if the limit can have a higher value than the increment (before the phi)
return true;

View File

@ -1409,11 +1409,11 @@ public:
}
return _limit;
}
const TypeInteger* limit_t(PhaseIterGVN& igvn) const {
const TypeInteger* limit_t(PhaseIterGVN& igvn, BasicType bt) const {
if (_should_speculatively_narrow_limit) {
return TypeLong::INT->filter(igvn.type(_limit)->is_long())->is_long();
}
return igvn.type(_limit)->is_int();
return igvn.type(_limit)->is_integer(bt);
}
bool can_speculatively_narrow_limit() {