On May 30, 2011, Alexandre Oliva wrote: > 3. expand dominators before dominated blocks, so that DEFs of > replaceable SSA names are expanded before their uses. Expand them when > they're encountered, but not requiring a REG as a result. Save the RTL > expression that results from the expansion for use in debug insns and at > the non-debug use. This patch addresses some of the problems in 2, avoiding expanding code out of order within a block, and (hopefully) ensuring that, expanding dominators before dominatedblocks, DEFs are expanded before USEs. There is a theoretical possibility that a USE may be expanded before a DEF, depending on internal details of out-of-ssa, but should this ever happen, we'll get a failed assertion, and then disabling TER will work around the problem. Since no special handling of force_reg is required and we don't reorder code, we don't need placeholders, and can record only the value expansion of replaceable DEFs for their uses, debug or not. Nevertheless, we expand each BB into a separate sequence, and then re-emit the blocks into a single sequence in the original order. This is a bit risky, as the logic of block expansion is modified, more so because the blocks created during expansion don't get separate sequences and require special handling, and other (unreachable?) blocks need to be expanded in a separate loop. This is the sort of code we get with this patch: ;; x_ = ****y_; (actually a sequence of replaceable gimple assignments) (set (reg) (mem (reg y_))) (set (reg) (mem (reg...))) (set (reg) (mem (reg...))) ;; debug x => x_ (debug_insn (var_location x (mem (reg)))) [...] ;; ? = x_ + 1; (set (reg x_) (mem (reg...))) (set (reg ?) (plus (reg x_) (const_int 1))) Note that the debug_insn binds to a computed expression, although that same expression is later stored in a register. This is slightly undesirable from a debug information POV, but it's probably something we can live with. No regressions in a regstrap on x86_64-linux-gnu and i686-linux-gnu.