------- Comment #10 from steven at gcc dot gnu dot org 2006-01-08 21:54 ------- Note that this code in resolve_branch is only slow for deeply nested programs with many gotos. The code in resolve_branch is linear in the size of the program, but if your program has many GOTO statements, say of the same order of magnitude as the size of the program, then you effectively get quadratic behavior in resolve_namespace.
I had the following idea to speed things up: 1. attach to each block a bitmap of statement labels defined in that block 2. compute a closure over the blocks tree to obtain a bitmap of all statement labels reachable from that block 3. in resolve_branch, only look at that bitmap. You would only have to do 2. once for each program unit. The bitmap check would be cheap obviously. You'd never have to walk the statements in resolve_branch, so you would make the quadratic behavior go away. Unfortunately I've never found the time to try to implement this idea. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18540