https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80603
Bug ID: 80603 Summary: Optimize loads from constant arrays or aggregates with arrays Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Created attachment 41301 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41301&action=edit gcc8-cst-load.patch The vrp113.c testcase (a copy of vrp40.c) is now XFAILed, because the switch optimization does a better job on it, but we don't manage to figure out that no matter what the index is we load always the same constant. For integer loads, we can also figure ranges from those even if the constants aren't the same, similarly for pointers (always NULL vs. always non-NULL vs. anything).