LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1171 - Eliminate domset from LLVM
Summary: Eliminate domset from LLVM
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Global Analyses (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Devang Patel
URL:
Keywords: quality-of-implementation
Depends on:
Blocks:
 
Reported: 2007-02-04 16:02 PST by Nick Lewycky
Modified: 2010-02-22 12:41 PST (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
testcase (296.90 KB, application/x-bz2)
2007-02-04 16:04 PST, Nick Lewycky
Details
"Source" .bc (102.24 KB, application/octet-stream)
2007-04-07 03:54 PDT, Anton Korobeynikov
Details
Bugpoint-reduced testcase (542 bytes, application/octet-stream)
2007-04-07 03:54 PDT, Anton Korobeynikov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2007-02-04 16:02:09 PST
This attachment causes -domset to eat up more than 512MB of RAM. Test with
"ulimit -v $((512*1024))"
Comment 1 Nick Lewycky 2007-02-04 16:04:01 PST
Created attachment 632 [details]
testcase

$ ulimit -v $((512*1024))
$ llvm/Debug/bin/opt -domset bugpoint-passes.bc 
WARNING: You're attempting to print out a bytecode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bytecode first-hand, you
can force output with the `-f' option.

terminate called after throwing an instance of 'St9bad_alloc'
  what():  St9bad_alloc
Aborted
Comment 2 Nick Lewycky 2007-02-04 16:04:47 PST
Chris points out that domset is O(n^2) and should just be eliminated.
Comment 3 Chris Lattner 2007-02-04 23:21:36 PST
on top of that, it's incredibly inefficient, even for being N^2 :)
Comment 4 Chris Lattner 2007-02-23 20:26:38 PST
The .bc file doesn't disassemble anymore.  Can you please attach a gzip'd .ll file?

-Chris
Comment 5 Anton Korobeynikov 2007-02-24 10:03:39 PST
I think, the source "testcase" was:

#define C(a,b) \
  if (a > b)  goto gt; \
  if (a < b)  goto lt;

#define C4(x,b) C((x)[0], b) C((x)[1],b) C((x)[2],b) C((x)[3],b)
#define C16(x,y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3])

#define C64(x,y) C16(x,y) C16(x+4,y) C16(x+8,y) C16(x+12,y)
#define C256(x,y) C64(x,y) C64(x,y+4) C64(x,y+8) C64(x,y+12)

#define C1024(x,y) C256(x,y) C256(x+16,y) C256(x+32,y) C256(x+48,y)
#define C4096(x,y) C1024(x,y) C1024(x,y+16) C1024(x,y+32) C1024(x,y+48)

unsigned foo(int x[64], int y[64])
{
  C4096(x,y);

  return 0x01234567;
 gt:
  return 0x12345678;
 lt:
  return 0xF0123456;
}
Comment 6 Nick Lewycky 2007-02-24 10:06:03 PST
The attachment is a .ll.bz2. I probably should've mentioned that.
Comment 7 Chris Lattner 2007-02-24 17:18:36 PST
Ah, ok.  So this is a simple case where you have a) a very very large program, and b) N^2 domsets.

The best solution is to eliminate domset from LLVM, so I'll change the title.

ET-Forest is now the preferred datastructure for most dom-set-like queries.

-Chris
Comment 8 Chris Lattner 2007-03-03 21:55:24 PST
One place to start:  LoopSimplify uses DominatorSet+DomTree.  Instead, it should use ETForest+DomTree.

-Chris
Comment 10 Anton Korobeynikov 2007-04-07 03:53:46 PDT
These changes prevents llvm-gcc from building. I'm attaching full testcase and
bugpoint-reduced.

Steps to reproduce:
./opt -licm
Comment 11 Anton Korobeynikov 2007-04-07 03:54:23 PDT
Created attachment 766 [details]
"Source" .bc
Comment 12 Anton Korobeynikov 2007-04-07 03:54:50 PDT
Created attachment 767 [details]
Bugpoint-reduced testcase
Comment 13 Anton Korobeynikov 2007-04-07 04:00:35 PDT
The "bad" patch is the one applied to LoopSimplify.cpp
Comment 14 Anton Korobeynikov 2007-04-07 04:16:11 PDT
So, I reverted two LoopSimplify.cpp patches and big "purge" patch (due to need
of DomSet for LoopSimplify). This fixed llvm-gcc.
Comment 15 Chris Lattner 2007-04-08 17:00:38 PDT
This is done, right Owen?  Care to close it?
Comment 16 Owen Anderson 2007-04-09 15:39:18 PDT
This is, indeed, done.