On Mon, Aug 6, 2012 at 1:07 PM, Paolo Bonzini <bonz...@gnu.org> wrote: > Il 06/08/2012 08:54, Steven Bosscher ha scritto: >> Hello, >> >> In PR54146, ifcvt spends a lot of time just clearing memory. This >> patch changes the value maps to pointer-maps to fix this issue. >> >> Bootstrapped&tested on x86_64-unknown-linux-gnu. OK? > > Nice, but perhaps we need a sparsemap to do even better?
If you mean sparseset: no, it won't do any better. My first idea was to use a sparseset, but: 1. The amount of memory allocated is simply too big. In fact, it'd be even worse than before: 4*max_regno*sizeof(rtx) instead of "only" 2*max_regno*sizeof(rtx). 2. sparseset has the same problem of memory clearing (for valgrind, see sparseset_alloc). Remember, we can call this function cond_move_convert_if_block O(n_basic_block) times: On a CFG with mostly regular control flow, i.e. no or few computed jumps, jump tables, and exception handlers, the number of IF-THEN-{,ELSE_}-JOIN blocks will be O(n_basic_blocks) and cond_move_convert_if_block is called on almost all of them. What could work, is to allocate a sparseset once at the beginning of if_convert, but I don't see any good reason to add a pair of global variables for this. My patch reduces the time spent in ifcvt to almost nothing (down from ~250s, which is still not so bad, considering we're looking at a function with >260000 basic blocks!). Ciao! Steven