Auto merge of #94214 - nikic:rust-opaque-pointers, r=cuviper
Prepare Rust for opaque pointers Fix one codegen bug with opaque pointers, and update our IR tests to accept both typed pointer and opaque pointer IR. This is a bit annoying, but unavoidable if we want decent test coverage on both LLVM 14 and LLVM 15. This prepares Rust for when LLVM will enable opaque pointers by default.
This commit is contained in:
commit
9d1aeaeb82
54 changed files with 265 additions and 289 deletions
|
@ -509,15 +509,20 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
OperandValue::Ref(place.llval, Some(llextra), place.align)
|
||||
} else if place.layout.is_llvm_immediate() {
|
||||
let mut const_llval = None;
|
||||
let llty = place.layout.llvm_type(self);
|
||||
unsafe {
|
||||
if let Some(global) = llvm::LLVMIsAGlobalVariable(place.llval) {
|
||||
if llvm::LLVMIsGlobalConstant(global) == llvm::True {
|
||||
const_llval = llvm::LLVMGetInitializer(global);
|
||||
if let Some(init) = llvm::LLVMGetInitializer(global) {
|
||||
if self.val_ty(init) == llty {
|
||||
const_llval = Some(init);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let llval = const_llval.unwrap_or_else(|| {
|
||||
let load = self.load(place.layout.llvm_type(self), place.llval, place.align);
|
||||
let load = self.load(llty, place.llval, place.align);
|
||||
if let abi::Abi::Scalar(scalar) = place.layout.abi {
|
||||
scalar_load_metadata(self, load, scalar, place.layout, Size::ZERO);
|
||||
}
|
||||
|
|
|
@ -304,8 +304,8 @@ impl CodegenBackend for LlvmCodegenBackend {
|
|||
local stack variable in the ABI.)
|
||||
|
||||
basic
|
||||
Generate stack canaries in functions with:
|
||||
- local variables of `[T; N]` type, where `T` is byte-sized and `N` > 8.
|
||||
Generate stack canaries in functions with local variables of `[T; N]`
|
||||
type, where `T` is byte-sized and `N` >= 8.
|
||||
|
||||
none
|
||||
Do not generate stack canaries.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue