Migrate to LLVM{Get,Set}ValueName2 #64223
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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: