On Thu, Nov 17, 2016 at 05:39:57PM -0800, Marek Polacek wrote: > > Yes, there will be 119 SAVE_EXPRs, and when you -fdump-tree-original it, > > it will be just insanely huge, but each SAVE_EXPR appears exactly twice > > in its containing SAVE_EXPR and the second time cp_genericize_r sees > > the SAVE_EXPR, it will do the > > 1138 /* Other than invisiref parms, don't walk the same tree > > twice. */ > > 1139 if (p_set->contains (stmt)) > > 1140 { > > 1141 *walk_subtrees = 0; > > 1142 return NULL_TREE; > > 1143 } > > early exit. > > Clearly I misread things here. I blame the cold I've caught! > > In any case, I'm sorry for wasting your time and I'll just close the PR.
I bet it is a compile-time hog with -fsanitize=undefined -fdump-tree-original. So, if anything, we'd need some hack in the SAVE_EXPR generic printing code, say track the depth of SAVE_EXPRs being printed concurrently and if we go above a certain level of them (say 10), change into a different mode where we print the content of SAVE_EXPR just the first time we encounter it + e.g. the SAVE_EXPR address and then when encountering the same SAVE_EXPR again, just print the address. When the SAVE_EXPR nesting level shrinks below 10, clear the pointer set of SAVE_EXPRs and resume normal behavior. -fsanitize=undefined -fdump-tree-gimple is fast. Jakub