-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Small structs should be passed in registers #6612
Comments
Note that the extra indirection is not present in the C++ equivalent (when compiled with -O9 for inlining): class IString {
public:
int operator==(const IString& other);
private:
int id;
};
int IString::operator==(const IString& other) {
return id == other.id;
}
int foo(IString a, IString b) { return a==b; } Not sure that's useful, just another data point. Also: the extra indirection also happens when declaring IString as |
(This bug might also be renamed, "small structs should be passed in registers"?) |
Yes, the reason is that our predicate "type_is_immediate" just considers all structs to be non-immediate, which is an oversimplification. |
In the following code, there is an extra layer of indirection in
foo
in the final code.Compiling with
-O -S
generates the following (trimmed to the relevant parts):i.e. the
IString
s are passed as pointers, not directly in registers.(I'm on x64 linux.)
The text was updated successfully, but these errors were encountered: