Skip to content

Commit e5a07a9

Browse files
authored
rustup: update to nightly-2021-05-24. (#631)
* rustup: update to nightly-2021-05-24. * tests: update expected OpLine numbers in disassembly tests.
1 parent 4afd2f3 commit e5a07a9

File tree

8 files changed

+59
-67
lines changed

8 files changed

+59
-67
lines changed

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 49 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -464,45 +464,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
464464
}
465465

466466
impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
467-
fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Function, _name: &'b str) -> Self {
468-
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
469-
let label = cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap();
470-
let cursor = cx.builder.select_block_by_id(label);
467+
fn build(cx: &'a Self::CodegenCx, llbb: Self::BasicBlock) -> Self {
468+
let cursor = cx.builder.select_block_by_id(llbb);
469+
// FIXME(eddyb) change `Self::Function` to be more like a function index.
470+
let current_fn = {
471+
let emit = cx.emit_with_cursor(cursor);
472+
let selected_function = emit.selected_function().unwrap();
473+
let selected_function = &emit.module_ref().functions[selected_function];
474+
let def_inst = selected_function.def.as_ref().unwrap();
475+
let def = def_inst.result_id.unwrap();
476+
let ty = def_inst.operands[1].unwrap_id_ref();
477+
def.with_type(ty)
478+
};
471479
Self {
472480
cx,
473481
cursor,
474-
current_fn: llfn,
475-
basic_block: label,
476-
current_span: Default::default(),
477-
}
478-
}
479-
480-
fn with_cx(cx: &'a Self::CodegenCx) -> Self {
481-
// Note: all defaults here *must* be filled out by position_at_end
482-
Self {
483-
cx,
484-
cursor: Default::default(),
485-
current_fn: 0.with_type(0),
486-
basic_block: Default::default(),
487-
current_span: Default::default(),
488-
}
489-
}
490-
491-
fn build_sibling_block(&self, _name: &str) -> Self {
492-
let mut builder = self.emit_with_cursor(BuilderCursor {
493-
function: self.cursor.function,
494-
block: None,
495-
});
496-
let new_bb = builder.begin_block(None).unwrap();
497-
let new_cursor = BuilderCursor {
498-
function: self.cursor.function,
499-
block: builder.selected_block(),
500-
};
501-
Self {
502-
cx: self.cx,
503-
cursor: new_cursor,
504-
current_fn: self.current_fn,
505-
basic_block: new_bb,
482+
current_fn,
483+
basic_block: llbb,
506484
current_span: Default::default(),
507485
}
508486
}
@@ -525,20 +503,42 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
525503
.line(file, loc.line as u32, loc.col_display as u32);
526504
}
527505

528-
fn position_at_end(&mut self, llbb: Self::BasicBlock) {
529-
let cursor = self.cx.builder.select_block_by_id(llbb);
530-
let current_fn = {
531-
let emit = self.emit_with_cursor(cursor);
532-
let selected_function = emit.selected_function().unwrap();
533-
let selected_function = &emit.module_ref().functions[selected_function];
534-
let def_inst = selected_function.def.as_ref().unwrap();
535-
let def = def_inst.result_id.unwrap();
536-
let ty = def_inst.operands[1].unwrap_id_ref();
537-
def.with_type(ty)
506+
// FIXME(eddyb) change `Self::Function` to be more like a function index.
507+
fn append_block(
508+
cx: &'a Self::CodegenCx,
509+
llfn: Self::Function,
510+
_name: &str,
511+
) -> Self::BasicBlock {
512+
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
513+
cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap()
514+
}
515+
516+
fn append_sibling_block(&mut self, _name: &str) -> Self::BasicBlock {
517+
self.emit_with_cursor(BuilderCursor {
518+
function: self.cursor.function,
519+
block: None,
520+
})
521+
.begin_block(None)
522+
.unwrap()
523+
}
524+
525+
fn build_sibling_block(&mut self, _name: &str) -> Self {
526+
let mut builder = self.emit_with_cursor(BuilderCursor {
527+
function: self.cursor.function,
528+
block: None,
529+
});
530+
let new_bb = builder.begin_block(None).unwrap();
531+
let new_cursor = BuilderCursor {
532+
function: self.cursor.function,
533+
block: builder.selected_block(),
538534
};
539-
self.cursor = cursor;
540-
self.current_fn = current_fn;
541-
self.basic_block = llbb;
535+
Self {
536+
cx: self.cx,
537+
cursor: new_cursor,
538+
current_fn: self.current_fn,
539+
basic_block: new_bb,
540+
current_span: Default::default(),
541+
}
542542
}
543543

544544
fn ret_void(&mut self) {
@@ -2207,11 +2207,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
22072207
self.intcast(val, dest_ty, false)
22082208
}
22092209

2210-
unsafe fn delete_basic_block(&mut self, _bb: Self::BasicBlock) {
2211-
// Ignore: If we were to delete the block, then other builder's selected_block index would become invalid, due
2212-
// to shifting blocks.
2213-
}
2214-
22152210
fn do_not_inline(&mut self, _llret: Self::Value) {
22162211
// Ignore
22172212
}

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rspirv::spirv::Word;
66
use rustc_codegen_ssa::mir::place::PlaceRef;
77
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
88
use rustc_middle::bug;
9-
use rustc_middle::mir::interpret::{AllocId, Allocation, GlobalAlloc, Pointer, ScalarMaybeUninit};
9+
use rustc_middle::mir::interpret::{alloc_range, Allocation, GlobalAlloc, ScalarMaybeUninit};
1010
use rustc_middle::ty::layout::TyAndLayout;
1111
use rustc_mir::interpret::Scalar;
1212
use rustc_span::symbol::Symbol;
@@ -415,10 +415,7 @@ impl<'tcx> CodegenCx<'tcx> {
415415
// only uses the input alloc_id in the case that the scalar is uninitilized
416416
// as part of the error output
417417
// tldr, the pointer here is only needed for the offset
418-
let value = match alloc
419-
.read_scalar(self, Pointer::new(AllocId(0), *offset), size)
420-
.unwrap()
421-
{
418+
let value = match alloc.read_scalar(self, alloc_range(*offset, size)).unwrap() {
422419
ScalarMaybeUninit::Scalar(scalar) => {
423420
self.scalar_to_backend(scalar, &self.primitive_to_scalar(primitive), ty)
424421
}

crates/rustc_codegen_spirv/src/codegen_cx/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'tcx> CodegenCx<'tcx> {
292292

293293
let mut op_entry_point_interface_operands = vec![];
294294

295-
let mut bx = Builder::new_block(self, stub_fn, "");
295+
let mut bx = Builder::build(self, Builder::append_block(self, stub_fn, ""));
296296
let mut call_args = vec![];
297297
let mut decoration_locations = FxHashMap::default();
298298
for (entry_arg_abi, hir_param) in arg_abis.iter().zip(hir_params) {

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
66

77
[toolchain]
8-
channel = "nightly-2021-05-17"
8+
channel = "nightly-2021-05-24"
99
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

tests/ui/dis/ptr_read.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
%8 = OpVariable %5 Function
66
OpLine %9 319 5
77
OpStore %8 %10
8-
OpLine %11 694 8
8+
OpLine %11 696 8
99
OpCopyMemory %8 %4
10-
OpLine %11 695 8
10+
OpLine %11 697 8
1111
%12 = OpLoad %13 %8
1212
OpLine %14 7 13
1313
OpStore %6 %12

tests/ui/dis/ptr_read_method.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
%8 = OpVariable %5 Function
66
OpLine %9 319 5
77
OpStore %8 %10
8-
OpLine %11 694 8
8+
OpLine %11 696 8
99
OpCopyMemory %8 %4
10-
OpLine %11 695 8
10+
OpLine %11 697 8
1111
%12 = OpLoad %13 %8
1212
OpLine %14 7 13
1313
OpStore %6 %12

tests/ui/dis/ptr_write.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ OpLine %9 7 35
77
%10 = OpLoad %11 %4
88
OpLine %9 7 13
99
OpStore %8 %10
10-
OpLine %12 878 8
10+
OpLine %12 880 8
1111
OpCopyMemory %6 %8
1212
OpLine %9 8 1
1313
OpReturn

tests/ui/dis/ptr_write_method.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ OpLine %9 7 37
77
%10 = OpLoad %11 %4
88
OpLine %12 1012 17
99
OpStore %8 %10
10-
OpLine %13 878 8
10+
OpLine %13 880 8
1111
OpCopyMemory %6 %8
1212
OpLine %9 8 1
1313
OpReturn

0 commit comments

Comments
 (0)