You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
ScalarRepl doesn't understand the pointer cast in this case, because one element of the struct is a
pointer (it handles {int,int} fine).
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
The text was updated successfully, but these errors were encountered:
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:
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.
pointer (it handles {int,int} fine).
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
The text was updated successfully, but these errors were encountered: