https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125307
--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> --- Currently each case in gswitch are stored as a CASE_LABEL_EXPR and that has 4 operands: CASE_LOW CASE_HIGH CASE_LABEL CASE_CHAIN CASE_CHAIN is null between passes. Inside passes if start_recording_case_labels is called, it is a link to the next CASE_LABEL_EXPR which has the same CASE_LABEL. Right now the following are the timings on the lookups: Label->bb : O(1) bb->cases : O(numofcases) case->edge: O(numberofedges) (basically label->bb then bb->edge) So here is my plan of attack for at least reducing memory usage. The first step is to change the return type of gimple_switch_label to a new struct (which at first just wraps the CASE_LABEL_EXPR/tree). Then changing that to be a lighter weight struct which contains the 4 fields. Then change it to be an array of that struct instead of an array of pointers. Note the only operands for a switch is the index, all others is just INTEGER_CST or LABEL_DECL or a chain to the next case.
