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

Instruction Selection Deeply Recurses #1177

Closed
asl opened this issue Jun 9, 2006 · 12 comments
Closed

Instruction Selection Deeply Recurses #1177

asl opened this issue Jun 9, 2006 · 12 comments
Labels
backend:X86 bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead

Comments

@asl
Copy link
Collaborator

asl commented Jun 9, 2006

Bugzilla Link 805
Resolution FIXED
Resolved on Mar 06, 2010 13:59
Version trunk
OS Windows 2000
Blocks llvm/llvm-bugzilla-archive#851
Attachments LLVM IR file, Log from llc -debug, Source .c file
CC @asl

Extended Description

Attached file caused llc to crash (llvm-gcc also). It seems to be insufficient
stack or something like this. Crash also occurs on md5.c code from libiberty.

I don't know the source of the problem and will investigate. Maybe this file
will crash llc on non-windows platform also.

Output from llc -debug is also attached. Just before crash I'm getting message like:

0075D433 (0x00000000 0x00000000 0x00000000 0x00000000)

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 9, 2006

Can't reproduce on Linux. The input bytecode file generates a 3228 line x86
assembly file.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 9, 2006

What format or encoding is the llc -debug log file in?

@asl
Copy link
Collaborator Author

asl commented Jun 9, 2006

Log is just plain bzip2 archive without any TAR'ing.

The end look very suspicious:

             Selecting: 0xfb2b08: i32 = TargetConstant <0>
             => 0xfb2b08: i32 = TargetConstant <0>
             Selecting: 0xfb1408: ch = store 0xfb1278, 0xfb11b0, 0xe5bee8,

0xe5c018
Selecting: 0xf9c5d0: i32 = TargetFrameIndex <22>

and all of this ("Selecting" lines) moves to the right until crash

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 9, 2006

Looking at the --debug output on linux, yields some information:

  1. There is a LOT of recursion going on here, about 50,000 calls
  2. The recursion goes quite deep .. I'd say over 1,000 calls
  3. The problem is occuring in instruction selection.

So, I'm changing the topic of this to "Instruction Selection Deeply Recurses"

I'll also attach the linux "llc --debug" output.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 9, 2006

Output from llc --debug on Linux
This is a bzip2 compressed text file of the output from llc --debug when run on
attachment 338 on Linux. The file shows massively deep recursion that should be
avoided.

@asl
Copy link
Collaborator Author

asl commented Jun 9, 2006

There is potential loop in Select->SelectCode->Select_*->Select

  • = load, for example

The cheap workaround will be constructing objects in Select_ on heap, not on
stack - this will allow deeper recursion

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 9, 2006

Yep. This is a known problem that is causing me considerable headache. Using a
worklist model to deal with the chain dependencies should help a lot (sort like
a list scheduling). Just don't have the time to deal with it right now.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 13, 2006

This is an important class of program that LLVM should handle without failing or
significantly recursing. While it only causes immediate grief on some platforms,
it would be prudent to add the .c file to the llvm-test suite so that we ensure
this problem does not regress.

Anton: what's the license for the .c file that you attached? Is it okay for us
to use this code in the llvm-test suite?

@asl
Copy link
Collaborator Author

asl commented Jun 13, 2006

Reid!

There is already a license header in the file:

  • Copyright 1993, Dr. James J. Gillogly
  • This code may be freely used in any application.
    */

So, I think it's ok to use source in tests. You might also take MD5 source code
from libiberty distribution - the problem does exist there.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 13, 2006

Sorry, as you can tell, I didn't even look at the code :)

I just assumed it was raw.

Thanks for cluing me in.

Reid

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 8, 2006

Fixed.

@lattner
Copy link
Collaborator

lattner commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#851

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead
Projects
None yet
Development

No branches or pull requests

3 participants