On Thu, Dec 07, 2023 at 09:36:23AM +0100, Jakub Jelinek wrote: > Without the dg-skip-if I got on 64-bit host: > cc1: out of memory allocating 571230784744 bytes after a total of 2772992 > bytes
I've looked at this and the problem is in haifa-sched.cc: 9047 h_i_d.safe_grow_cleared (3 * get_max_uid () / 2, true); get_max_uid () is 0x4000024d with the --param min-nondebug-insn-uid=0x40000000 and so 3 * get_max_uid () / 2 actually overflows to -536870028 but as vec.h then treats the value as unsigned, it attempts to allocate 0xe0000374U * 152UL bytes, i.e. those 532GB. If the above is fixed to do 3U * get_max_uid () / 2 instead, it will get slightly better and will only need 0x60000373U * 152UL bytes, i.e. 228GB. Even better improvement would be change haifa-sched.cc, so that the vector contains just pointers to _haifa_insn_data rather than the structures themselves, then we'd just allocate 12GB for the vector itself and then as needed for the actual data. But at the expense of slowing the scheduler a little bit. And the question is how sparse typically the insn uids are when scheduling without --param min-nondebug-insn-uid= Jakub