-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Migrate to LLVM{Get,Set}ValueName2 #64223
Comments
Any idea how old the new APIs are? I don't see any reason not to switch other than that. |
They were added in llvm/llvm-project@025c78f which is in the 7.0 release, what's our minimum supported LLVM version these days? |
The current minimum is 6, but considering the constraints raised when it was bumped from 5 to 6 (#56642) it seems to me that bumping to 7 might be OK already. Worth a try IMO. |
I just realized, if we cared enough we could also provide our own equivalent of these functions in src/rustllvm (and just remove them when we drop LLVM 6 support). The C API was just lagging behind, the C++ APIs have supported it for much longer. |
FYI, #66973 bumps to LLVM 7. |
We currently use the C APIs
LLVM{Get,Set}ValueName
which return/take a 0-terminatedchar *
, but those APIs have been deprecated a while ago in favor ofLLVM{Get,Set}ValueName2
which return/take pairs ofchar *
+ length (the C-friendly lowering ofllvm::StringRef
) which need not be 0-terminated. We should migrate to those APIs. Besides avoiding silly error cases for names that contain a 0 byte, it would also make conversions from&str
to LLVM name free, and reduce the cost of the opposite direction to an UTF-8 validity check (plus, I suspect many or all code paths that do that could just as well use&[u8]
, and that conversion actually is 100% free).The text was updated successfully, but these errors were encountered: