On 6/16/2026 7:41 AM, Richard Biener wrote:
On Mon, 8 Jun 2026, Abhishek Kaushik wrote:
determine_value_range only queried ranger when VAR was an SSA_NAME.
However, number_of_iterations_exit_assumptions calls
expand_simple_operations on the IV bases before asking for the range.
This can expose simple GENERIC expressions, including conversions, even
when the original value had an SSA_NAME with useful range information.
Ranger can analyze such expressions at a program point or edge, so query
it for integral bound expressions on the loop preheader edge rather than
restricting the query to SSA_NAMEs. This lets niter analysis recover the
narrower range for value-preserving conversions such as uint8_t to int,
while still handling non-value-preserving conversions and wrapping
expressions conservatively.
The new test covers a direct converted uint8_t bound, a masked uint16_t
bound whose useful range comes from ranger, a guarded uint16_t bound
whose range is context-sensitive, a non-value-preserving uint8_t to
int8_t conversion, and a wrapping unsigned expression.
Bootstrapped and regression tested on aarch64-unknown-linux-gnu.
OK.
Sorry for the delay,
And since I don't think Abhishek has write access, I went ahead and
pushed this.
jeff