Skip to content

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

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

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 49 additions & 54 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,45 +464,23 @@ impl<'a, 'tcx> 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 {
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
let label = cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap();
let cursor = cx.builder.select_block_by_id(label);
fn build(cx: &'a Self::CodegenCx, llbb: Self::BasicBlock) -> Self {
let cursor = cx.builder.select_block_by_id(llbb);
// FIXME(eddyb) change `Self::Function` to be more like a function index.
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 {
cx,
cursor,
current_fn: llfn,
basic_block: label,
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_fn,
basic_block: llbb,
current_span: Default::default(),
}
}
Expand All @@ -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);
}

fn position_at_end(&mut self, llbb: Self::BasicBlock) {
let cursor = self.cx.builder.select_block_by_id(llbb);
let current_fn = {
let emit = self.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)
// FIXME(eddyb) change `Self::Function` to be more like a function index.
fn append_block(
cx: &'a Self::CodegenCx,
llfn: Self::Function,
_name: &str,
) -> Self::BasicBlock {
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap()
}

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.current_fn = current_fn;
self.basic_block = llbb;
Self {
cx: self.cx,
cursor: new_cursor,
current_fn: self.current_fn,
basic_block: new_bb,
current_span: Default::default(),
}
}

fn ret_void(&mut self) {
Expand Down Expand Up @@ -2207,11 +2207,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
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) {
// Ignore
}
Expand Down
7 changes: 2 additions & 5 deletions crates/rustc_codegen_spirv/src/codegen_cx/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rspirv::spirv::Word;
use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
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_mir::interpret::Scalar;
use rustc_span::symbol::Symbol;
Expand Down Expand Up @@ -415,10 +415,7 @@ impl<'tcx> CodegenCx<'tcx> {
// only uses the input alloc_id in the case that the scalar is uninitilized
// as part of the error output
// tldr, the pointer here is only needed for the offset
let value = match alloc
.read_scalar(self, Pointer::new(AllocId(0), *offset), size)
.unwrap()
{
let value = match alloc.read_scalar(self, alloc_range(*offset, size)).unwrap() {
ScalarMaybeUninit::Scalar(scalar) => {
self.scalar_to_backend(scalar, &self.primitive_to_scalar(primitive), ty)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/codegen_cx/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl<'tcx> CodegenCx<'tcx> {

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 decoration_locations = FxHashMap::default();
for (entry_arg_abi, hir_param) in arg_abis.iter().zip(hir_params) {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".

[toolchain]
channel = "nightly-2021-05-17"
channel = "nightly-2021-05-24"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
4 changes: 2 additions & 2 deletions tests/ui/dis/ptr_read.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
%8 = OpVariable %5 Function
OpLine %9 319 5
OpStore %8 %10
OpLine %11 694 8
OpLine %11 696 8
OpCopyMemory %8 %4
OpLine %11 695 8
OpLine %11 697 8
%12 = OpLoad %13 %8
OpLine %14 7 13
OpStore %6 %12
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/dis/ptr_read_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
%8 = OpVariable %5 Function
OpLine %9 319 5
OpStore %8 %10
OpLine %11 694 8
OpLine %11 696 8
OpCopyMemory %8 %4
OpLine %11 695 8
OpLine %11 697 8
%12 = OpLoad %13 %8
OpLine %14 7 13
OpStore %6 %12
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_write.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OpLine %9 7 35
%10 = OpLoad %11 %4
OpLine %9 7 13
OpStore %8 %10
OpLine %12 878 8
OpLine %12 880 8
OpCopyMemory %6 %8
OpLine %9 8 1
OpReturn
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_write_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OpLine %9 7 37
%10 = OpLoad %11 %4
OpLine %12 1012 17
OpStore %8 %10
OpLine %13 878 8
OpLine %13 880 8
OpCopyMemory %6 %8
OpLine %9 8 1
OpReturn
Expand Down