https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91374
--- Comment #2 from Hao Liu <hliu at amperecomputing dot com> --- (In reply to Richard Biener from comment #1) > So you ask for main to be converted to > > if (idx == 0) > foo_32_16 (); > else /* idx == 1 */ > foo_16_8 (); > > correct? It shoulds like an interesting idea for an IPA-CP cloning > opportunity. But I wonder how much real-world testcases exists > that are not benchmarks ;) One could tell by implementing the > analysis into the param analysis stage (look for defs that are > loads from a constant initialized entity, possibly multiple of them > and (some of them) reusing the same memory index). A related thing > would be to value-profile the indexes since when the array doesn't > only contain two values it isn't feasible to clone for all possible > values. Proberbly. Actually we can just versioning "width", as "height" may be independent to "width" (my case misleads by using the same array index) and "height" doesn't affect performance too much. So the expected result could be: if (width == 16) foo_w16 (); else /* width == 8 */ foo_w8 ();