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

            Bug ID: 84776
           Summary: Indefinite compile time w/ var-tracking
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: compile-time-hog
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc-8.0.0-alpha20180225 snapshot (r257975), 7.3, 6.3, 5.4, 4.9.4, 4.8.5, 4.7.4
all take indefinite time when compiling the following snippet w/ -g -O3
(-Ofast) -fno-tree-dce --param max-completely-peel-times=20 --param
max-vartrack-expr-depth=20:

int
vv (int ob)
{
  int hw = ob;
  int kh = hw;

  for (ob = 0; ob < 20; ++ob)
    hw *= hw;

  return kh;
}

gcc 4.6.4 doesn't have param max-vartrack-expr-depth. -fno-var-tracking fixes
the issue.

% timeout 5 gcc-8.0.0-alpha20180225 -g -O3 -fno-tree-dce --param
max-completely-peel-times=20 --param max-vartrack-expr-depth=20 -c rogfdfw4.c
zsh: exit 124   timeout 5 gcc-8.0.0-alpha20180225 -g -O3 -fno-tree-dce --param 
--param  -c

perf top captures the following profile:

  27.96%  cc1  [.] simplify_binary_operation_1
  23.79%  cc1  [.] avoid_constant_pool_reference
  15.57%  cc1  [.] simplify_binary_operation
  13.21%  cc1  [.] commutative_operand_precedence
   8.49%  cc1  [.] simplify_associative_operation
   5.90%  cc1  [.] simplify_const_binary_operation
   2.59%  cc1  [.] swap_commutative_operands_p
   1.08%  cc1  [.] HONOR_NANS
   0.80%  cc1  [.] HONOR_SIGNED_ZEROS
   0.54%  cc1  [.] HONOR_SNANS
   0.05%  cc1  [.] ggc_internal_alloc

Reply via email to