Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate domset from LLVM #1543

Closed
nlewycky opened this issue Feb 5, 2007 · 15 comments
Closed

Eliminate domset from LLVM #1543

nlewycky opened this issue Feb 5, 2007 · 15 comments
Labels
bugzilla Issues migrated from bugzilla quality-of-implementation

Comments

@nlewycky
Copy link
Contributor

nlewycky commented Feb 5, 2007

Bugzilla Link 1171
Resolution FIXED
Resolved on Feb 22, 2010 12:41
Version trunk
OS All
Attachments testcase
CC @asl,@lattner

Extended Description

This attachment causes -domset to eat up more than 512MB of RAM. Test with
"ulimit -v $((512*1024))"

@nlewycky
Copy link
Contributor Author

nlewycky commented Feb 5, 2007

Chris points out that domset is O(n^2) and should just be eliminated.

@lattner
Copy link
Collaborator

lattner commented Feb 5, 2007

on top of that, it's incredibly inefficient, even for being N^2 :)

@lattner
Copy link
Collaborator

lattner commented Feb 24, 2007

The .bc file doesn't disassemble anymore. Can you please attach a gzip'd .ll file?

-Chris

@asl
Copy link
Collaborator

asl commented Feb 24, 2007

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;
}

@nlewycky
Copy link
Contributor Author

The attachment is a .ll.bz2. I probably should've mentioned that.

@lattner
Copy link
Collaborator

lattner commented Feb 25, 2007

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

@lattner
Copy link
Collaborator

lattner commented Mar 4, 2007

One place to start: LoopSimplify uses DominatorSet+DomTree. Instead, it should use ETForest+DomTree.

-Chris

@asl
Copy link
Collaborator

asl commented Apr 7, 2007

These changes prevents llvm-gcc from building. I'm attaching full testcase and
bugpoint-reduced.

Steps to reproduce:
./opt -licm

@asl
Copy link
Collaborator

asl commented Apr 7, 2007

"Source" .bc

@asl
Copy link
Collaborator

asl commented Apr 7, 2007

@asl
Copy link
Collaborator

asl commented Apr 7, 2007

The "bad" patch is the one applied to LoopSimplify.cpp

@asl
Copy link
Collaborator

asl commented Apr 7, 2007

So, I reverted two LoopSimplify.cpp patches and big "purge" patch (due to need
of DomSet for LoopSimplify). This fixed llvm-gcc.

@lattner
Copy link
Collaborator

lattner commented Apr 9, 2007

This is done, right Owen? Care to close it?

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 9, 2007

This is, indeed, done.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
jeanPerier pushed a commit to jeanPerier/llvm-project that referenced this issue Apr 1, 2022
A dummy argument in an entry point of a subprogram with multiple
entry points need not be defined in other entry points.  It is only
legal to reference such an argument when calling an entry point that
does have a definition.  An entry point without such a definition
needs a local "substitute" definition sufficient to generate code.
It is nonconformant to reference such a definition at runtime.
Most such definitions and associated code will be deleted as dead
code at compile time.  However, that is not always possible, as in
the following code.  This code is conformant if all calls to entry
point ss set m=3, and all calls to entry point ee set n=3.

  subroutine ss(a, b, m, d, k) ! no x, y, n
    integer :: a(m), b(a(m)), m, d(k)
    integer :: x(n), y(x(n)), n
    integer :: k
  1 print*, m, k
    print*, a
    print*, b
    print*, d
    if (m == 3) return
  entry ee(x, y, n, d, k) ! no a, b, m
    print*, n, k
    print*, x
    print*, y
    print*, d
    if (n /= 3) goto 1
  end

    integer :: xx(3), yy(5), zz(3)
    xx = 5
    yy = 7
    zz = 9
    call ss(xx, yy, 3, zz, 3)
    call ss(xx, yy, 3, zz, 3)
  end

Lowering currently generates fir::UndefOp's for all unused arguments.
This is usually ok, but cases such as the one here incorrectly access
unused UndefOp arguments for m and n from an entry point that doesn't
have a proper definition.

The problem is addressed by creating a more complete definition of an
unused argument in most cases.  This is implemented in large part by
moving the definition of an unused argument from mapDummiesAndResults
to mapSymbolAttributes.  The code in mapSymbolAttributes then chooses
one of three code generation options, depending on information
available there.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla quality-of-implementation
Projects
None yet
Development

No branches or pull requests

4 participants