Bug 87700 - [8/9 Regression] Compile time hog w/ -O1
Summary: [8/9 Regression] Compile time hog w/ -O1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 8.3
Assignee: Richard Biener
URL:
Keywords: compile-time-hog
Depends on:
Blocks:
 
Reported: 2018-10-23 06:55 UTC by Arseny Solokha
Modified: 2018-10-23 10:00 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 8.2.0
Known to fail:
Last reconfirmed: 2018-10-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2018-10-23 06:55:15 UTC
gcc-9.0.0-alpha20181021 snapshot (r265361) takes indefinite time when compiling the following snippet w/ -O1:

void
wn (int ki)
{
  int m8 = 0;
  int *d6 = &ki;

  if (ki == 0)
    {
 ud:
      for (ki = 0; ki < 1; ++ki)
        for (m8 = 0; m8 < 1; ++m8)
          goto ud;

      d6 = &m8;

 y8:
      ++m8;

 xw:
      if (ki == 0)
        {
        }
      else
        {
          for (m8 = 0; m8 < 1; ++m8)
            {
 gt:
              if (*d6 == 0)
                goto y8;
            }

          for (m8 = 0; m8 < 1; ++m8)
            {
              goto gt;

 ym:
              ;
            }
        }

      d6 = &ki;

      goto ym;
    }

  goto xw;
}

% timeout 10 gcc-9.0.0-alpha20181021 -O1 -c ehynqp9p.c
zsh: exit 124   timeout 10 gcc-9.0.0-alpha20181021 -O1 -c ehynqp9p.c

perf top:

Overhead  Sha  Symbol
  15.94%  cc1  [.] operand_equal_p
  14.86%  cc1  [.] inchash::add_expr
  12.49%  cc1  [.] add_ssa_edge
   8.54%  cc1  [.] copy_prop::visit_phi
   7.87%  cc1  [.] ssa_propagation_engine::simulate_stmt
   6.65%  cc1  [.] iterative_hash
   6.41%  cc1  [.] ssa_propagation_engine::ssa_propagate
   6.05%  cc1  [.] bitmap_set_bit
   4.07%  cc1  [.] useless_type_conversion_p
   3.71%  cc1  [.] iterative_hash_host_wide_int
   2.68%  cc1  [.] may_propagate_copy
   2.68%  cc1  [.] bitmap_clear_bit
   2.51%  cc1  [.] tree_operand_check
   2.42%  cc1  [.] bitmap_first_set_bit
   1.91%  cc1  [.] tree_strip_nop_conversions
   0.89%  cc1  [.] element_precision
   0.31%  cc1  [.] commutative_tree_code
Comment 1 Richard Biener 2018-10-23 07:48:18 UTC
This looks like a latent issue in set_copy_of_val.  The GCC 8 branch is also affected after backporting the SSA propagator re-org.  Testing patch.
Comment 2 Richard Biener 2018-10-23 09:36:03 UTC
Author: rguenth
Date: Tue Oct 23 09:35:31 2018
New Revision: 265417

URL: https://gcc.gnu.org/viewcvs?rev=265417&root=gcc&view=rev
Log:
2018-10-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87700
	* tree-ssa-copy.c (set_copy_of_val): Fix change detection logic.

	* gcc.dg/torture/pr87700.c: New testcase.

Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr87700.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
    branches/gcc-8-branch/gcc/tree-ssa-copy.c
Comment 3 Richard Biener 2018-10-23 09:36:49 UTC
Author: rguenth
Date: Tue Oct 23 09:36:13 2018
New Revision: 265418

URL: https://gcc.gnu.org/viewcvs?rev=265418&root=gcc&view=rev
Log:
2018-10-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87700
	* tree-ssa-copy.c (set_copy_of_val): Fix change detection logic.

	* gcc.dg/torture/pr87700.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr87700.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-copy.c
Comment 4 Richard Biener 2018-10-23 10:00:31 UTC
Fixed.