-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Deduced _BitInt type with certain values causes assert in EmitGlobalVarDefinition #85139
Comments
@llvm/issue-subscribers-clang-codegen Author: Erich Keane (erichkeane)
I found this messing around with _BitInt
https://godbolt.org/z/d6EYahK85
See stack trace below. It seems that the static_cast of SOMETHING (or the result of the expression on the RHS?) PLUS a deduced type is required. ALSO the value of the size of the I haven't mapped out ALL the values, but it seems a little odd where the holes are.
|
The failing code is:
in llvm-project/clang/lib/CodeGen/CodeGenModule.cpp Line 5346 in decd88e
For this example, The AST type is The IR type is CC @efriedma-quic @rjmccall -- this might be another _BitInt-alignment-ABI-related issue? |
Sounds like we can't use |
The store size for a 257-bit integer should be 264 bits, regardless of the ABI alignment. The ABI alignment only matters for stuff like struct layout and the size of global variables. So we just need to use a different type to represent the value in memory; we can continue to use the obvious operations for load/store/etc. This isn't completely new territory; booleans also have different "memory" and "register" types. This shouldn't significantly impact code quality; LLVM already basically ignores the declared types of variables. |
You're right that we can still emit simple loads and stores. What I'm worried about is the fact that a constant initializer is probably going to have to be broken up into individual bytes. I suppose there's no reason LLVM couldn't be taught to fold a load of that back into an |
I found this messing around with _BitInt
https://godbolt.org/z/d6EYahK85
See stack trace below. It seems that the static_cast of SOMETHING (or the result of the expression on the RHS?) PLUS a deduced type is required. ALSO the value of the size of the
_BitInt
doesn't have an obvious pattern. All values sub-129 seem valid, but 255 and 256 are both valid (so its not a power-of-2 thing?). It seems any value 193-256 is valid as well (only spot checked).I haven't mapped out ALL the values, but it seems a little odd where the holes are.
The text was updated successfully, but these errors were encountered: