[LLVMbugs] [Bug 10090] New: ScalarEvolution: requires 8MB stack size to compile a test case with long "value chain"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 6 13:52:54 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10090

           Summary: ScalarEvolution: requires 8MB stack size to compile a
                    test case with long "value chain"
           Product: new-bugs
           Version: 2.9
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bixia.zheng at amd.com
                CC: llvmbugs at cs.uiuc.edu


The test case below stress the recursive algorithm used in ScalarEvulution.
On 64bit win7 with stack size set to 4MB, running "opt -O3" gives stack
overflow. Increasing the stack size to 8MB makes "opt -O3" pass.

We need a solution that does not rely on increasing the stack size:
(1) make the recursive algorithm aware of the depth of the recursive call
chains. This makes it possible to trade-off optimization aggressiveness for
small stack size
 or 
(2) to replace the recursive algorithm with a non-recursive algorithm without
such a problem.


//test case
#define REPEAT_1 i1 = i1 ^ i2; i2 += i1; n++;

#define REPEAT_5 \
    REPEAT_1 \
    REPEAT_1 \
    REPEAT_1 \
    REPEAT_1 \
    REPEAT_1

#define REPEAT_10 \
    REPEAT_5 \
    REPEAT_5 \

#define REPEAT_50 \
    REPEAT_10 \
    REPEAT_10 \
    REPEAT_10 \
    REPEAT_10 \
    REPEAT_10

#define REPEAT_100 \
    REPEAT_50 \
    REPEAT_50 \


#define REPEAT_500 \
    REPEAT_100 \
    REPEAT_100 \
    REPEAT_100 \
    REPEAT_100 \
    REPEAT_100

#define REPEAT_1000 \
    REPEAT_500 \
    REPEAT_500 \


extern int getid(int);
void foo(unsigned int *output)
{
  unsigned int i1 = -1, i2 = 0, n = getid(0), sum = 0;

  for (unsigned loop = 0; loop < 1; loop++) {
    // repeat the "i1 = .." line 2000 times
    REPEAT_1000
    REPEAT_1000
    sum += i1 + n;
  }

  *output = sum;
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list