On Thu, Apr 05, 2018 at 02:32:08PM +0200, Richard Biener wrote:
> 
> This fixes exponential time spent in find_base_term by extending the
> existing fix of NULL-ifying VALUE locations during their processing
> to keep them NULL-ified during the whole recursion.
> 
> As Jakub figured this has the chance of returning NULL prematurely
> for the case of the plus/minus case rejecting a found base on the
> ground of
> 
>         if (base != NULL_RTX
>             && ((REG_P (tmp1) && REG_POINTER (tmp1))
>                  || known_base_value_p (base)))
>           return base;
> 
> so any VALUE visited during a such rejected base will not be
> visited again (but we'll get a NULL result).
> 
> Quoting him from IRC: still no differences, out of 850mil calls

The final statistics across full simultaneous x86_64-linux and i686-linux
bootstraps + regtests is 5 cases where the patch changed result from
4.6 billion find_base_term toplevel calls, all like:
64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr53698.c test2 symbol_ref 
0x7f765b2cc840 0 symbol_ref 0x7f765b2cc858 0
64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr53698.c test2 symbol_ref 
0x7f765b2cc870 0 symbol_ref 0x7f765b2cc888 0
64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr53698.c test2 symbol_ref 
0x7f765b2cd2e8 0 symbol_ref 0x7f765b2cd300 0
64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr53698.c test2 symbol_ref 
0x7f765b2cd378 0 symbol_ref 0x7f765b2cd390 0
64 /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr53698.c test2 symbol_ref 
0x7f765b2cd3a8 0 symbol_ref 0x7f765b2cd3c0 0
but when looking at it under debugger, both result from old find_base_term
and new find_base_term look like:
(gdb) p debug_rtx (res)
(symbol_ref:DI ("foo") [flags 0x40] <var_decl 0x7ffff7ff6e10 foo>)
(gdb) p debug_rtx (res2)
(symbol_ref:DI ("foo") [flags 0x40] <var_decl 0x7ffff7ff6e10 foo>)
just they don't compare pointer equal.  Because it is -mx32, guess it is
just result of
        rtx temp = find_base_value (XEXP (src, 0));

        if (temp != 0 && CONSTANT_P (temp))
          temp = convert_memory_address (Pmode, temp);
on SImode SYMBOL_REF and thus not a real difference we'd care about.

        Jakub

Reply via email to