-
Notifications
You must be signed in to change notification settings - Fork 103
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][CIRGen][TBAA] Add support for scalar types #1220
Conversation
follow #1076 (review) This patch adds support for TBAA with scalar types. It retrieves type names in the TBAAPass, utilizing as much information from the CIR as possible, rather than duplicating the original codegen implementation in CIRGenTBAA. A limitation of this patch is that it cannot handle long long types. Instead, long long is treated as long. Specifically, long long is represented as s64i in CIR, and I have mapped s64i to the long type. |
I have update the patch. please review again.
I would appreciate your thoughts on this limitation. |
clang/lib/CIR/CodeGen/CIRGenTBAA.cpp
Outdated
// Pointee values may have incomplete types, but they shall never be | ||
// dereferenced. | ||
if (accessType->isIncompleteType()) { | ||
llvm_unreachable("NYI"); |
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.
Our internal builds use -O2
to build our apps, and seems like this path and some of the others will always run under -O2
. For paths that will unconditionally run, you are better off with, e.g. assert(!MissingFeature::tbaaIncompleteType())
or something. Can you confirm that all added unrecheables are never executed just yet? An alternative is to add a temporary cc1 flag and only enable tbaa when the flag is used, once you are done with the full work you would remove the flag.
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.
Our internal builds use -O2 to build our apps, and seems like this path and some of the others will always run under -O2
did not encounter the NYI issue when run with -O2
. it may be related to the struct type.
I think adding MissingFeatures::tbaaIncompleteType()
would be a good idea.
Haven't had the time to dig just yet, we can look at that once this is closer to be merged! |
Changes Summary
|
I noticed the How about adding a |
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 a few more nits and this looks ready!
If structs change as part of ABI lowering or new ones get created, we'll need to update information accordingly, but I think those can be handled directly as part of LowerTypes and whatnots.
Attributes are value semantic, so MLIR should cache things for us. Do you have an example of something that might escape that? |
fee1cbf
to
021df4f
Compare
021df4f
to
a1aae06
Compare
Let's discuss the scenario where I have submitted patch support for struct types. |
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, thanks for your patience!
For long long
, can you create an issue describing the problem and we can discuss it there? My feeling is that it will need some type changes in CIR to accommodate and will require it's own PR anyways.
added #1241 |
) This patch follows #1220 (comment) by augmenting `CIR_Type` with a new field, `tbaaName`. Specifically, it enables TableGen support for the `-gen-cir-tbaa-name-lowering` option, allowing for the generation of `getTBAAName` functions based on the `tbaaName`. This enhancement enables us to replace the hardcoded TBAA names in the `getTypeName` function with the newly generated `getTBAAName`.
No description provided.