Skip to content

[llvmgcc] Passing large structures by value to functions results in large code. #1117

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

Closed
llvmbot opened this issue Apr 21, 2006 · 5 comments
Closed
Labels
bugzilla Issues migrated from bugzilla llvm-tools All llvm tools that do not have corresponding tag quality-of-implementation

Comments

@llvmbot
Copy link
Member

llvmbot commented Apr 21, 2006

Bugzilla Link 745
Resolution FIXED
Resolved on Mar 06, 2010 14:00
Version 1.0
OS All
Depends On llvm/llvm-bugzilla-archive#1521
Reporter LLVM Bugzilla Contributor

Extended Description

#include <stdlib.h>

struct RT {
char a;
char b;
int c;
int d[50][50];
} glob;

int main(int argc, char **argv) {
glob.a = 1;
glob.b = 2;
glob.c = 3;
printf("glob.1 = %d\n", *(&glob + 1));
}

compiles 62 seconds, spits out 18kb bc file with 5063 tmp vars. For
larger arrays (say 1000 X 2000) it never returns. GCC has no problems
compiling such examples.

A 10-liner shouldn't kill the compiler :-)

Domagoj

@lattner
Copy link
Collaborator

lattner commented Apr 21, 2006

It would be nice to fix this, but it's totally unrealistic code (i.e. performance of any code that uses this sort
of thing would be completely horrible).

Also, most of the compile time is probably spent on the same reason as Bug 473.

-Chris

@lattner
Copy link
Collaborator

lattner commented Apr 21, 2006

fwiw., this code should use memcpy instead of individual field copies.

@lattner
Copy link
Collaborator

lattner commented Sep 26, 2007

*** Bug llvm/llvm-bugzilla-archive#1104 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator

lattner commented Oct 9, 2007

*** Bug llvm/llvm-bugzilla-archive#1498 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator

lattner commented Jan 16, 2008

This has been fixed in llvm and llvm-gcc, and awaits specific targets to pick it up. You should be good on x86 and x86-64 now. Thanks to Rafael and Evan for making this happen for 2.2

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
xlauko pushed a commit to trailofbits/instafix-llvm that referenced this issue Mar 28, 2025
follow llvm/clangir#1033
handle `LongDoubleType` with `FP80Type`.
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 llvm-tools All llvm tools that do not have corresponding tag quality-of-implementation
Projects
None yet
Development

No branches or pull requests

2 participants