I have 3 different, mutually exclusive patches that fix PR 48866. The problem is exponential time while dealing with an expression that resulted from a long chain of replaceable insns with memory accesses moved past the debug insns referring to their results.
1. emit debug temps for replaceable DEFs that end up being referenced in debug insns. We already have some code to try to deal with this, but it emits the huge expressions we'd rather avoid, and it may create unnecessary duplication. This new approach emits a placeholder instead of skipping replaceable DEFs altogether, and then, if the DEF is referenced in a debug insn (perhaps during the late debug re-expasion of some other placeholder), it is expanded. Placeholders that end up not being referenced are then throw away. 2. emit placeholders for replaceable DEFs and, when the DEFs are expanded at their point of use, emit the expansion next to the placeholder, rather than at the current stream. The result of the expansion is saved and used in debug insns that reference the replaceable DEF. If the result is forced into a REG shortly thereafter, the code resulting from this is also emitted next to the placeholder, and the saved expansion is updated. If the USE is expanded before the DEF, the insn stream resulting from the expansion is saved and emitted at the point of the DEF. 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. I'll post each patch with further details in separate follow-up e-mails. -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer