rustup: update to nightly-2021-05-24. (#631)

* rustup: update to nightly-2021-05-24.

* tests: update expected OpLine numbers in disassembly tests.
This commit is contained in:
Eduard-Mihai Burtescu 2021-05-25 09:28:47 +03:00 committed by GitHub
parent 4afd2f39ae
commit e5a07a9e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 67 deletions

View File

@ -464,45 +464,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} }
impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Function, _name: &'b str) -> Self { fn build(cx: &'a Self::CodegenCx, llbb: Self::BasicBlock) -> Self {
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx)); let cursor = cx.builder.select_block_by_id(llbb);
let label = cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap(); // FIXME(eddyb) change `Self::Function` to be more like a function index.
let cursor = cx.builder.select_block_by_id(label); let current_fn = {
let emit = cx.emit_with_cursor(cursor);
let selected_function = emit.selected_function().unwrap();
let selected_function = &emit.module_ref().functions[selected_function];
let def_inst = selected_function.def.as_ref().unwrap();
let def = def_inst.result_id.unwrap();
let ty = def_inst.operands[1].unwrap_id_ref();
def.with_type(ty)
};
Self { Self {
cx, cx,
cursor, cursor,
current_fn: llfn, current_fn,
basic_block: label, basic_block: llbb,
current_span: Default::default(),
}
}
fn with_cx(cx: &'a Self::CodegenCx) -> Self {
// Note: all defaults here *must* be filled out by position_at_end
Self {
cx,
cursor: Default::default(),
current_fn: 0.with_type(0),
basic_block: Default::default(),
current_span: Default::default(),
}
}
fn build_sibling_block(&self, _name: &str) -> Self {
let mut builder = self.emit_with_cursor(BuilderCursor {
function: self.cursor.function,
block: None,
});
let new_bb = builder.begin_block(None).unwrap();
let new_cursor = BuilderCursor {
function: self.cursor.function,
block: builder.selected_block(),
};
Self {
cx: self.cx,
cursor: new_cursor,
current_fn: self.current_fn,
basic_block: new_bb,
current_span: Default::default(), current_span: Default::default(),
} }
} }
@ -525,20 +503,42 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
.line(file, loc.line as u32, loc.col_display as u32); .line(file, loc.line as u32, loc.col_display as u32);
} }
fn position_at_end(&mut self, llbb: Self::BasicBlock) { // FIXME(eddyb) change `Self::Function` to be more like a function index.
let cursor = self.cx.builder.select_block_by_id(llbb); fn append_block(
let current_fn = { cx: &'a Self::CodegenCx,
let emit = self.emit_with_cursor(cursor); llfn: Self::Function,
let selected_function = emit.selected_function().unwrap(); _name: &str,
let selected_function = &emit.module_ref().functions[selected_function]; ) -> Self::BasicBlock {
let def_inst = selected_function.def.as_ref().unwrap(); let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
let def = def_inst.result_id.unwrap(); cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap()
let ty = def_inst.operands[1].unwrap_id_ref(); }
def.with_type(ty)
fn append_sibling_block(&mut self, _name: &str) -> Self::BasicBlock {
self.emit_with_cursor(BuilderCursor {
function: self.cursor.function,
block: None,
})
.begin_block(None)
.unwrap()
}
fn build_sibling_block(&mut self, _name: &str) -> Self {
let mut builder = self.emit_with_cursor(BuilderCursor {
function: self.cursor.function,
block: None,
});
let new_bb = builder.begin_block(None).unwrap();
let new_cursor = BuilderCursor {
function: self.cursor.function,
block: builder.selected_block(),
}; };
self.cursor = cursor; Self {
self.current_fn = current_fn; cx: self.cx,
self.basic_block = llbb; cursor: new_cursor,
current_fn: self.current_fn,
basic_block: new_bb,
current_span: Default::default(),
}
} }
fn ret_void(&mut self) { fn ret_void(&mut self) {
@ -2207,11 +2207,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
self.intcast(val, dest_ty, false) self.intcast(val, dest_ty, false)
} }
unsafe fn delete_basic_block(&mut self, _bb: Self::BasicBlock) {
// Ignore: If we were to delete the block, then other builder's selected_block index would become invalid, due
// to shifting blocks.
}
fn do_not_inline(&mut self, _llret: Self::Value) { fn do_not_inline(&mut self, _llret: Self::Value) {
// Ignore // Ignore
} }

View File

@ -6,7 +6,7 @@ use rspirv::spirv::Word;
use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods}; use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::mir::interpret::{AllocId, Allocation, GlobalAlloc, Pointer, ScalarMaybeUninit}; use rustc_middle::mir::interpret::{alloc_range, Allocation, GlobalAlloc, ScalarMaybeUninit};
use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::layout::TyAndLayout;
use rustc_mir::interpret::Scalar; use rustc_mir::interpret::Scalar;
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
@ -415,10 +415,7 @@ impl<'tcx> CodegenCx<'tcx> {
// only uses the input alloc_id in the case that the scalar is uninitilized // only uses the input alloc_id in the case that the scalar is uninitilized
// as part of the error output // as part of the error output
// tldr, the pointer here is only needed for the offset // tldr, the pointer here is only needed for the offset
let value = match alloc let value = match alloc.read_scalar(self, alloc_range(*offset, size)).unwrap() {
.read_scalar(self, Pointer::new(AllocId(0), *offset), size)
.unwrap()
{
ScalarMaybeUninit::Scalar(scalar) => { ScalarMaybeUninit::Scalar(scalar) => {
self.scalar_to_backend(scalar, &self.primitive_to_scalar(primitive), ty) self.scalar_to_backend(scalar, &self.primitive_to_scalar(primitive), ty)
} }

View File

@ -292,7 +292,7 @@ impl<'tcx> CodegenCx<'tcx> {
let mut op_entry_point_interface_operands = vec![]; let mut op_entry_point_interface_operands = vec![];
let mut bx = Builder::new_block(self, stub_fn, ""); let mut bx = Builder::build(self, Builder::append_block(self, stub_fn, ""));
let mut call_args = vec![]; let mut call_args = vec![];
let mut decoration_locations = FxHashMap::default(); let mut decoration_locations = FxHashMap::default();
for (entry_arg_abi, hir_param) in arg_abis.iter().zip(hir_params) { for (entry_arg_abi, hir_param) in arg_abis.iter().zip(hir_params) {

View File

@ -5,5 +5,5 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'". # to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain] [toolchain]
channel = "nightly-2021-05-17" channel = "nightly-2021-05-24"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"] components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

View File

@ -5,9 +5,9 @@
%8 = OpVariable %5 Function %8 = OpVariable %5 Function
OpLine %9 319 5 OpLine %9 319 5
OpStore %8 %10 OpStore %8 %10
OpLine %11 694 8 OpLine %11 696 8
OpCopyMemory %8 %4 OpCopyMemory %8 %4
OpLine %11 695 8 OpLine %11 697 8
%12 = OpLoad %13 %8 %12 = OpLoad %13 %8
OpLine %14 7 13 OpLine %14 7 13
OpStore %6 %12 OpStore %6 %12

View File

@ -5,9 +5,9 @@
%8 = OpVariable %5 Function %8 = OpVariable %5 Function
OpLine %9 319 5 OpLine %9 319 5
OpStore %8 %10 OpStore %8 %10
OpLine %11 694 8 OpLine %11 696 8
OpCopyMemory %8 %4 OpCopyMemory %8 %4
OpLine %11 695 8 OpLine %11 697 8
%12 = OpLoad %13 %8 %12 = OpLoad %13 %8
OpLine %14 7 13 OpLine %14 7 13
OpStore %6 %12 OpStore %6 %12

View File

@ -7,7 +7,7 @@ OpLine %9 7 35
%10 = OpLoad %11 %4 %10 = OpLoad %11 %4
OpLine %9 7 13 OpLine %9 7 13
OpStore %8 %10 OpStore %8 %10
OpLine %12 878 8 OpLine %12 880 8
OpCopyMemory %6 %8 OpCopyMemory %6 %8
OpLine %9 8 1 OpLine %9 8 1
OpReturn OpReturn

View File

@ -7,7 +7,7 @@ OpLine %9 7 37
%10 = OpLoad %11 %4 %10 = OpLoad %11 %4
OpLine %12 1012 17 OpLine %12 1012 17
OpStore %8 %10 OpStore %8 %10
OpLine %13 878 8 OpLine %13 880 8
OpCopyMemory %6 %8 OpCopyMemory %6 %8
OpLine %9 8 1 OpLine %9 8 1
OpReturn OpReturn