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

[scalarrepl] Should be able to scalarrepl 'union's with pointers in them #1264

Closed
lattner opened this issue Aug 30, 2006 · 3 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla code-quality

Comments

@lattner
Copy link
Collaborator

lattner commented Aug 30, 2006

Bugzilla Link 892
Resolution FIXED
Resolved on Feb 22, 2010 12:54
Version 1.0
OS MacOS X

Extended Description

Consider:
#include
struct Val {
int *A, B;
Val() : A(0), B(2) {}
};
Val foo();
void bar(Val X, Val Y);

void test(Val Op) {
bar(Op, foo());
}
on X86.

We currently generate really horrible code, because we are not able to eliminate any intermediate 'Val'
objects. We should do the right thing in three places, but don't do any of them:

  1. llvm-gcc4 is lowering the 'pass struct by value' code into bad code that casts the address of the
    struct to a long*, then loads/stores the entire struct at once. It doesn't need to do this. In this specific
    case on X86, it can pass the two elements and get the same effect.
  2. ScalarRepl doesn't understand the pointer cast in this case, because one element of the struct is a
    pointer (it handles {int,int} fine).
  3. The code generator should handle this, because the 'long' load/stores gets split into 2x i32 loads,
    which should be forward prop'd. However, because it's not using (even trivial) alias analysis, it doesn't
    get this.

We should fix this problem at all of these levels.

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Aug 30, 2006

assigned to @lattner

@lattner
Copy link
Collaborator Author

lattner commented Oct 9, 2006

#​3 is taken care of when Jim's CodeGen AA stuff is enabled.

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Oct 9, 2006

@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 Jan 4, 2022
Fixes the descriptor to properly span each element of a CHARACTER array.
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 code-quality
Projects
None yet
Development

No branches or pull requests

1 participant