-
Notifications
You must be signed in to change notification settings - Fork 104
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
[CIR][Lowering] Lower unions #230
Conversation
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. [ghstack-poisoned]
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: e2d7031104cc9c70995f5ab2f5b330a937fcad8e Pull Request resolved: #230
} | ||
} | ||
|
||
return largestTy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like we do for mutable std::optional<bool> padded{};
and others in computeSizeAndAlignment
, I think we should only compute the type once and re-use the value in subsequent calls. In this case it's even easier because an empty mlir::Type
is enough to track "not done yet".
Also, please do all computation in computeSizeAndAlignment
and make getLargestMember
check if the Type is valid, if not, call in computeSizeAndAlignment
and return the said type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bcardosolopes applied
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. [ghstack-poisoned]
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 791a944c5df3103c5671ba061fe4c7c3a56317fa Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. [ghstack-poisoned]
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 88b2927a5a9c094e6d948148e68079659f79cdd2 Pull Request resolved: #230
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. [ghstack-poisoned]
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: llvm/clangir#230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: llvm#230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: llvm#230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: llvm/clangir#230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: llvm#230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: llvm#230
Converts a union to a struct containing only its largest element. GetMemberOp for unions is lowered as bitcasts instead of GEPs, since union members share the same address space. ghstack-source-id: 744ac312675b8f3225ccc459fcd09474bcfcfe81 Pull Request resolved: #230
Stack from ghstack (oldest at bottom):
Converts a union to a struct containing only its largest element.
GetMemberOp for unions is lowered as bitcasts instead of GEPs, since
union members share the same address space.