https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102356

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
   Last reconfirmed|                            |2021-09-16
             Status|UNCONFIRMED                 |NEW
          Component|c                           |rtl-optimization
            Summary|compile-time explosion at   |compile-time explosion at
                   |-O3                         |-O3 -g in var-tracking
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We hang in

#0  0x000000000109ceeb in HONOR_NANS (m=E_SImode)
    at ../../src/gcc-11-branch/gcc/real.c:5436
#1  0x00000000011529b2 in simplify_context::simplify_binary_operation_1 (
    this=0x7fffffffce4c, code=MULT, mode=E_SImode, op0=0x7ffff671f740, 
    op1=0x7ffff66e0cc0, trueop0=0x7ffff671f740, trueop1=0x7ffff66e0cc0)
    at ../../src/gcc-11-branch/gcc/simplify-rtx.c:3043
#2  0x000000000114fbf5 in simplify_context::simplify_binary_operation (
    this=0x7fffffffce4c, code=MULT, mode=E_SImode, op0=0x7ffff671f740, 
    op1=0x7ffff66e0cc0) at ../../src/gcc-11-branch/gcc/simplify-rtx.c:2423
#3  0x000000000114f312 in simplify_context::simplify_associative_operation (
    this=0x7fffffffce4c, code=MULT, mode=E_SImode, op0=0x7ffff63e6768, 
    op1=0x7ffff66e0cc0) at ../../src/gcc-11-branch/gcc/simplify-rtx.c:2154
#4  0x0000000001152ede in simplify_context::simplify_binary_operation_1 (
    this=0x7fffffffce4c, code=MULT, mode=E_SImode, op0=0x7ffff63e6768, 
    op1=0x7ffff66e0cc0, trueop0=0x7ffff63e6768, trueop1=0x7ffff66e0cc0)
    at ../../src/gcc-11-branch/gcc/simplify-rtx.c:3101
...
#2678 0x0000000000cd0e36 in simplify_binary_operation (code=MULT, 
    mode=E_SImode, op0=0x7ffff63b0030, op1=0x7ffff63b0030)
    at ../../src/gcc-11-branch/gcc/rtl.h:3457
#2679 0x0000000001166284 in simplify_rtx (x=0x7ffff63b0090)
    at ../../src/gcc-11-branch/gcc/simplify-rtx.c:7431

#2680 0x0000000000c17b3d in cselib_expand_value_rtx_1 (orig=0x7ffff67290f0, 
    evd=0x7fffffffcf80, max_depth=2147483647)
    at ../../src/gcc-11-branch/gcc/cselib.c:2025
#2681 0x0000000000c171b5 in cselib_expand_value_rtx_cb (orig=0x7ffff67290f0, 
    regs_active=0x32c1470, max_depth=2147483647, 
    cb=0x15433ec <vt_expand_loc_callback(rtx, bitmap, int, void*)>, 
    data=0x7fffffffd2c0) at ../../src/gcc-11-branch/gcc/cselib.c:1732
#2682 0x0000000001543222 in vt_expand_var_loc_chain (var=0x3493748, 
    regs=0x32c1470, data=0x7fffffffd2c0, pendrecp=0x7fffffffd087)
    at ../../src/gcc-11-branch/gcc/var-tracking.c:8421
#2683 0x0000000001543623 in vt_expand_loc_callback (x=0x33e6128, 
    regs=0x32c1470, max_depth=2147483647, data=0x7fffffffd2c0)
    at ../../src/gcc-11-branch/gcc/var-tracking.c:8584
#2684 0x0000000000c1765e in cselib_expand_value_rtx_1 (orig=0x33e6128, 
    evd=0x7fffffffd1c0, max_depth=2147483647)
    at ../../src/gcc-11-branch/gcc/cselib.c:1885
#2685 0x0000000000c171b5 in cselib_expand_value_rtx_cb (orig=0x33e6128, 
--Type <RET> for more, q to quit, c to continue without paging--
    regs_active=0x32c1470, max_depth=2147483647, 
    cb=0x15433ec <vt_expand_loc_callback(rtx, bitmap, int, void*)>, 
    data=0x7fffffffd2c0) at ../../src/gcc-11-branch/gcc/cselib.c:1732
#2686 0x0000000001543222 in vt_expand_var_loc_chain (var=0x3493680, 
    regs=0x32c1470, data=0x7fffffffd2c0, pendrecp=0x0)
    at ../../src/gcc-11-branch/gcc/var-tracking.c:8421
#2687 0x00000000015438b2 in vt_expand_1pvar (var=0x3493680, vars=0x34bc6f0)
    at ../../src/gcc-11-branch/gcc/var-tracking.c:8697
#2688 0x0000000001543b2a in emit_note_insn_var_location (varp=0x342e100, 
    data=0x7fffffffd650) at ../../src/gcc-11-branch/gcc/var-tracking.c:8751
#2689 0x000000000154b4af in hash_table<variable_hasher, false,
xcallocator>::traverse_noresize<emit_note_data*,
&(emit_note_insn_var_location(variable**, emit_note_data*))> (this=0x3431620,
argument=0x7fffffffd650)
    at ../../src/gcc-11-branch/gcc/hash-table.h:1081
#2690 0x0000000001549f2f in hash_table<variable_hasher, false,
xcallocator>::traverse<emit_note_data*,
&(emit_note_insn_var_location(variable**, emit_note_data*))> (this=0x3431620,
argument=0x7fffffffd650)
    at ../../src/gcc-11-branch/gcc/hash-table.h:1102
#2691 0x0000000001544e40 in emit_notes_for_changes (insn=0x7ffff670cb00, 
    where=EMIT_NOTE_BEFORE_INSN, vars=0x328d7b0)
    at ../../src/gcc-11-branch/gcc/var-tracking.c:9111
#2692 0x0000000001545d18 in emit_notes_in_bb (
    bb=<basic_block 0x7ffff66f4340 (11)>, set=0x7fffffffd7b0)
--Type <RET> for more, q to quit, c to continue without paging--
    at ../../src/gcc-11-branch/gcc/var-tracking.c:9483
#2693 0x00000000015461ae in vt_emit_notes ()
    at ../../src/gcc-11-branch/gcc/var-tracking.c:9604
#2694 0x0000000001548814 in variable_tracking_main_1 ()
    at ../../src/gcc-11-branch/gcc/var-tracking.c:10552
#2695 0x000000000154884a in variable_tracking_main ()
    at ../../src/gcc-11-branch/gcc/var-tracking.c:10566
#2696 0x00000000015488d7 in (anonymous
namespace)::pass_variable_tracking::execute (this=0x326d380) at
../../src/gcc-11-branch/gcc/var-tracking.c:10603
#2697 0x000000000105944a in execute_one_pass (
    pass=<opt_pass* 0x326d380 "vartrack"(325)>)
    at ../../src/gcc-11-branch/gcc/passes.c:2567

and at the toplevel we simplify a _very_ _very_ deep recursive RTX.  We're
passing in

/* This is the value used during expansion of locations.  We want it
   to be unbounded, so that variables expanded deep in a recursion
   nest are fully evaluated, so that their values are cached
   correctly.  We avoid recursion cycles through other means, and we
   don't unshare RTL, so excess complexity is not a problem.  */
#define EXPR_DEPTH (INT_MAX)

which might be the problem.  The debug_insns themselves are nicely flat
but the testcase results in

        movzbl  uc_9(%rip), %eax
        imull   %edi, %eax
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L20
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L21
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L37
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L11
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L11
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L11
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L11
        imull   %eax, %eax
        testl   %eax, %eax
        je      .L53

where we might be tempted to pick up the whole x*x*x*x*x... chain N times.

Reply via email to