-
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
llvm: replace some deprecated functions, add fixmes #109862
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
// FIXME: deprecated, replace with LLVMMDStringInContext2 | ||
pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value; | ||
|
||
// LLVMMDStringInContext but don't own string | ||
pub fn LLVMMDStringInContext2(C: &Context, Str: *const c_char, SLen: size_t) -> &Metadata; |
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.
I can probably replace LLVMMDStringInContext
with LLVMMDStringInContext2
all around, using value<->metadata wrappers around, but don't know is it worth it.
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.
It looks like some of them are sensible to replace at least. E.g. in consts.rs LLVMMDStringInContext and LLVMMDNodeInContext can be replaced with the 2 variants (just need to replace both of them together and it works out fine).
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.
Yes, but void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)
rust/compiler/rustc_codegen_llvm/src/consts.rs
Lines 507 to 512 in 90a9f69
let meta = llvm::LLVMMDNodeInContext(self.llcx, data.as_ptr(), 2); | |
llvm::LLVMAddNamedMetadataOperand( | |
self.llmod, | |
"wasm.custom_sections\0".as_ptr().cast(), | |
meta, | |
); |
https://github.com/llvm/llvm-project/blame/02aa966c135172885182ddd6f5d76883c2402bed/llvm/lib/IR/Core.cpp#L1292-L1300
feeds in LLVMValueRef , but LLVMMDNodeInContext2 will return LLVMMetadataRef, so wrap\unwrap (or rewrite LLVMAddNamedMetadataOperand).
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.
Also void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)
prevents refactor too, sadly.
pub fn LLVMBuildCleanupPad<'a>( | ||
B: &Builder<'a>, | ||
ParentPad: Option<&'a Value>, | ||
ArgCnt: c_uint, | ||
Args: *const &'a Value, | ||
NumArgs: c_uint, | ||
Name: *const c_char, | ||
) -> Option<&'a Value>; |
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.
Sometimes llvm type LLVMValueRef
modeled in rust as Option<&'a Value>
, sometimes as &'a Value
, where LLVMValueRef
can be nullptr:
https://github.com/llvm/llvm-project/blame/42d1b276f7793999be3f9b6a99efbb143254c729/llvm/lib/IR/Core.cpp#L3170-L3178
It feels wrong and can lead to funny results, or i'm wrong? Don't have strong c++ here, so advice requested.
@rustbot author |
@rustbot ready |
r? nikic |
… LLVMValueRef, some that accept LLVMMetadataRef, and replacing one with another not always possible without explicit convertion
… LLVMRustMetadataTypeInContext with LLVMMetadataTypeInContext
LLVMRustBuildCleanupPad -> LLVMBuildCleanupPad LLVMRustBuildCleanupRet -> LLVMBuildCleanupRet LLVMRustBuildCatchPad -> LLVMBuildCatchPad LLVMRustBuildCatchRet -> LLVMBuildCatchRet LLVMRustBuildCatchSwitch -> LLVMBuildCatchSwitch
// FIXME: deprecated, replace with LLVMMDStringInContext2 | ||
pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value; | ||
|
||
// LLVMMDStringInContext but don't own string | ||
pub fn LLVMMDStringInContext2(C: &Context, Str: *const c_char, SLen: size_t) -> &Metadata; |
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.
It looks like some of them are sensible to replace at least. E.g. in consts.rs LLVMMDStringInContext and LLVMMDNodeInContext can be replaced with the 2 variants (just need to replace both of them together and it works out fine).
@rustbot ready |
@bors r+ rollup |
llvm: replace some deprecated functions, add fixmes Replace some deprecated llvm functions, add FIXME's (for simpler future work), replace some rust custom functions with llvm ones.
llvm: replace some deprecated functions, add fixmes Replace some deprecated llvm functions, add FIXME's (for simpler future work), replace some rust custom functions with llvm ones.
maybe this was the cause of https://github.com/notifications#issuecomment-1500588281? |
⌛ Testing commit c0bc001 with merge 7d6375c5f6ff8809fe43ad38f6fb068b850dd2d9... |
💔 Test failed - checks-actions |
Yes, can reproduce when building stage2 compiler, but don't have idea why, for now. fails on f41e711 |
This comment has been minimized.
This comment has been minimized.
@rustbot ready fixed issue with B/bool type |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (dd2b195): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Replace some deprecated llvm functions, add FIXME's (for simpler future work), replace some rust custom functions with llvm ones.