On Tue, Jun 15, 2021 at 09:43:33AM -0400, Andrew MacLeod wrote: > > > + basic_block bb; > > > + int_range_max r; > > > + FOR_EACH_BB_FN (bb, cfun) > > > + { > > > + gimple *last = last_stmt (bb); > > > + if (last && gimple_get_lhs (last)) > > > + ranger.range_of_stmt (r, last); > > which is only doing it for the last stmts in the basic blocks if any. > > So e.g. in the common case of GIMPLE_COND at the end of a bb it does > > nothing. > > > > Jakub > > > In fact, you can simply drop the gimple_get_lhs (last) part of the > condition... range_of_stmt works just fine without a LHS, and will then > calculate the GIMPLE_COND operands.
But even then, not every stmt in the bb participates in the computation of the value (if any) of the last stmt in the block, some stmts could compute values only used in the PHIs or in the middle of other bbs, others could store to memory, or be calls without return value, ... If ranger does caching, can't it just call range_of_stmt on every non-debug stmt in the bb? Jakub