Bug 34148 - [4.3 Regression] Too many VOPs, too deep tree-ssa-sccvn.c recursion
Summary: [4.3 Regression] Too many VOPs, too deep tree-ssa-sccvn.c recursion
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 blocker
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: compile-time-hog, memory-hog
Depends on:
Blocks: 33870
  Show dependency treegraph
Reported: 2007-11-19 10:50 UTC by Richard Biener
Modified: 2007-11-21 12:01 UTC (History)
4 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2007-11-19 11:05:38

testcase (unreduced) (61.04 KB, application/octet-stream)
2007-11-19 10:51 UTC, Richard Biener
worse testcase (43.22 KB, application/octet-stream)
2007-11-20 12:21 UTC, Richard Biener

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2007-11-19 10:50:56 UTC
With the fix for PR33870 we now create _loads_ of VOPs for QTs qmake makefile.cpp
at even -O so that all machines I have either run OOM or with a debug build of
gcc, tree-ssa-sccvn.c:1853 (DFS visiting VUSEs) recurses too deeply and blows
the 8MB stack on x86_64 (and takes too much compile-time).

Which means, we no longer can build QT.
Comment 1 Richard Biener 2007-11-19 10:51:55 UTC
Created attachment 14577 [details]
testcase (unreduced)
Comment 2 Steven Bosscher 2007-11-19 11:05:38 UTC
tree-ssa-sccvn should use a non-recursive DFS algorithm.  Though, that is only part of the solution here, I suppose.
Comment 3 Richard Biener 2007-11-19 11:19:01 UTC
Yes, I wonder if we can "cut" the DFS walk somewhere - in this case we have
1000s of stmts with each ~200 VUSEs...
Comment 4 Richard Biener 2007-11-19 11:23:53 UTC
One workaround in this case is to run another forwprop / dce between inlining
and the first alias pass.  This get's rid of a lot of pointers and pointed
to temporaries.  Still that doesn't address the fundamental problems here.
(but it makes the testcase work nicely within a bound of 600MB peak
memory usage)
Comment 5 Richard Biener 2007-11-19 17:38:26 UTC
With just a forwprop pass after inlining and before salias we miscompile
cp/semantics.c:pop_to_parent_deferring_access_checks() at -O2.
An optimization barrier like

pop_to_parent_deferring_access_checks (void)
  if (deferred_access_no_check)
      VEC (deferred_access_check,gc) *checks;
      deferred_access *ptr;

      checks = (VEC_last (deferred_access, deferred_access_stack)

      VEC_pop (deferred_access, deferred_access_stack);
__asm__ __volatile__ ("" : : : "memory");
      ptr = VEC_last (deferred_access, deferred_access_stack);

fixes it.  Reducing max-aliased-vops to 100 (as with -O1 which also passes)
fixes the problem as well.  -O1 -fstrict-aliasing
--param max-aliased-vops=500 (as with -O2) also breaks.  Disabling DOM
makes it work again.
Comment 6 Richard Biener 2007-11-20 12:20:22 UTC
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01046.html fixes the miscompile
of the C++ frontend.

-fno-strict-aliasing makes the testcase consume a lot more memory than
-fstrict-aliasing.  Which is why -O is also a lot worse than -O2.

What one can also notice is that we create lots of unpartitionable SFTs for
structures with just _one_ SFT -- we should not need to create SFTs for those
at all.
Comment 7 Richard Biener 2007-11-20 12:21:13 UTC
Created attachment 14585 [details]
worse testcase
Comment 8 Richard Biener 2007-11-21 10:16:35 UTC
Subject: Bug 34148

Author: rguenth
Date: Wed Nov 21 10:16:21 2007
New Revision: 130329

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130329
2007-11-21  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/34148
	* tree-ssa-structalias.c (create_variable_info_for): Do not use
	field-sensitive PTA for single-element structures.
	* tree-ssa-alias.c (create_overlap_variables_for): Do not create
	SFTs for single-element structures.


Comment 9 Richard Biener 2007-11-21 12:01:38 UTC