17503 – quadratic behaviour in invalid_mode_change_p (original) (raw)

| Description Daniel Jacobowitz 2004-09-15 16:50:51 UTC Compiling insn-attrtab.i with compilers from a few weeks ago, this function is way down the profile. Now it's at the very top. :bool :invalid_mode_change_p (unsigned int regno, enum reg_class class, : enum machine_mode from_mode) 625 0.1102 55 0.5528 :{ /* invalid_mode_change_p total: 117807 20.7631 4747 47.7085 */ : enum machine_mode to_mode; : int n; 113 0.0199 17 0.1709 : int start = regno * MAX_MACHINE_MODE; : 116873 20.5985 4675 46.9849 : EXECUTE_IF_SET_IN_BITMAP (&subregs_of_mode, start, n, : if (n >= MAX_MACHINE_MODE + start) : return 0; : to_mode = n - start; : if (CANNOT_CHANGE_MODE_CLASS (from_mode, to_mode, class)) : return 1; : ); : return 0; 196 0.0345 0 0.0e+00 :} I am not positive whether the function is being called more, or just spending more time in the bitmap, but it looks like the latter - we're creating many more entries in subregs_of_mode. I selected a random call to invalid_mode_change_p, and compared the size of the bitmap in both compilers. In the older compiler, the high entry in the bitmap was around 10,000 bits; in the newer, around 450,000. The newer compiler was updated this morning. Comment 1 Drea Pinski 2004-09-15 17:49:33 UTC Most likely caused by: 2004-09-14 Roger Sayle <roger@eyesopen.com> PR rtl-optimization/9771 * regclass.c (CALL_REALLY_USED_REGNO_P): New macro to eliminate conditional compilation in init_reg_sets_1. (init_reg_sets_1): Let global_regs[i] take priority over the frame (but not stack) pointer exceptions to regs_invalidated_by_call. (globalize_reg): Globalizing a fixed register may need to update regs_invalidated_by_call. Comment 2 roger 2004-09-15 19:09:02 UTC I find it extremely unlikely that the patch mentioned in comment #2 could have any performance impact, even on code that declares register variables which should be the only observable functionality change. Daniel, I wonder whether you could re-run your profiles after reverting my patch and confirm there's no performance change, i.e. that it's innocent? Comment 3 Daniel Jacobowitz 2004-09-20 19:23:26 UTC Yes, Roger's patch is innocent. Richard, I haven't narrowed it down to one patch yet, but it's down to the six-hour window in which you committed the patch for PR 9997. That's my suspect. There is no substantive difference in the RTL diffs except that numbers for pseudoregisters get larger: -(insn 9 8 10 1 (set (reg:SI 59 [ T.665 ]) +(insn 9 8 10 1 (set (reg:SI 11374 [ T.665 ]) (mem/s/j:SI (plus:SI (reg/f:SI 11377) and stack offsets fluctuate a bit. I'll verify that I've pegged the right patch. Do we need to do this at -O0? Comment 4 Daniel Jacobowitz 2004-09-20 19:54:15 UTC Yes, definitely caused by that patch. Comment 5 Richard Henderson 2004-09-20 21:41:00 UTC "Huge"? Ok, so the thing's now at the top of the profile, but it still only uses four (4) seconds of cpu time, so fixing it isn't going to help *that* much. I've reduced the severity of the pr. I suspect that you can only see this effect at -O0 with Truely Large synthetic functions, as seen in insn-attrtab.c. So I am caring only a little at the moment. Note that the "regression" comes not from the stack slot sharing per-se, but actually honoring use_register_for_decl, which is true for scalar temporaries. Comment 6 Richard Henderson 2004-09-20 22:16:51 UTC Created attachment 7182 [details] possible patch Given that you seem to care, Daniel, please try this patch on a number of platforms. At minumum, i386 and ia64 would be good. Comment 7 Daniel Jacobowitz 2004-09-21 15:21:18 UTC Thanks. Patch bootstrapped on ia64-hpux, i386-linux, and powerpc-linux with no regressions. Clears up the performance spike for cc1-i-files at -O0 and decreases page faults on some other testing by a (very) small amount. Comment 9 Richard Henderson 2004-09-24 20:00:06 UTC Fixed. Comment 11 Richard Henderson 2004-10-13 16:59:23 UTC *** Bug 16834 has been marked as a duplicate of this bug. *** | | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |