On 10/2/26 3:14 AM, Aldy Hernandez wrote:
Currently a load from a constant table gets the range of the whole
table, no matter what is known of its index. For example, with
static const int tbl[4] = { 0, 5, 6, 7 };
and i in [0, 1], tbl[i] is currently [0, 0][5, 7]. With this patch we
get [0, 0][5, 5].
This work comes from my DOM parity obsession, but goes beyond what DOM
gets here. DOM folds a load from a constant table only when the index
can be determined to be a constant, as on the path through i = 1 in:
[ ... ]
I for one am happy with your DOM parity obsession.
As we discussed in Prague, DOM accumulated all kinds of things over time
that in modern times can likely be done better elsewhere. This is just
one of many examples.
Jeff