https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99011
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-02-09 Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. The issue is the array accesses remain variable and there's no transform that turns a two-valued variable access into two (constant folded) accesses plus a select. Depending on how expensive it is to load the constants such transform may not always be profitable. Given we're looking for a two-valued variable access it might be tempting to do the transform in VRP where there's also a related PR around deriving a range for the loaded value from the entries of the indexed array (PR80603).