On 03/05/2013 09:30 AM, Jakub Jelinek wrote:
Hi!
cselib (probably among others) isn't prepared to handle arbitrarily
complex debug insns. The debug insns are usually created from debug stmts
which shouldn't have unbound complexity, but with TER we can actually end up
with arbitrarily large debug insns.
This patch fixes that up during expansion, by splitting subexpressions of
too large debug insn expressions into their own debug temporaries.
So far bootstrapped/regtested on x86_64-linux and i686-linux without the
first two hunks (it caused one failure on the latter because of invalid RTL
sharing), I'm going to bootstrap/regtest it again, ok for trunk if it
passes?
2013-03-05 Jakub Jelinek <ja...@redhat.com>
PR debug/56510
* cfgexpand.c (expand_debug_parm_decl): Call copy_rtx on incoming.
(avoid_complex_debug_insns): New function.
(expand_debug_locations): Call it.
* gcc.dg/pr56510.c: New test.
So it's not that cselib (and possibly others) can't handle these complex
RTL expressions, it's just unbearably slow. Right?
}
+/* Ensure INSN_VAR_LOCATION_LOC (insn) doesn't have unbound complexity.
+ Allow 4 levels of rtl nesting for most rtl codes, and if we see anything
+ deeper than that, create DEBUG_EXPRs and emit DEBUG_INSNs before INSN. */
:-) Similar to a comment I made in someone else's patch, I don't like
the magic number "4", but I don't think this is worth creating a PARAM
for controlling its behaviour.
+
+static void
+avoid_complex_debug_insns (rtx insn, rtx *exp_p, int depth)
+{
+ rtx exp = *exp_p;
+ if (exp == NULL_RTX)
+ return;
+ if ((OBJECT_P (exp) && !MEM_P (exp)) || GET_CODE (exp) == CLOBBER)
+ return;
A blank line or two seems to be missing above.
Fine with the trivial formatting fix assuming your bootstrap/regtest is OK.
Jeff