Skip to content
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

Rollup of 8 pull requests #82928

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f847ff1
Added #[repr(transparent)] to core::cmp::Reverse
imbrem Feb 8, 2021
095bf01
Improve sift_down performance in BinaryHeap
hanmertens Jan 17, 2021
516988b
Impl StatementKind::CopyNonOverlapping
JulianKnodt Oct 3, 2020
a058d44
Update fmt and use of memcpy
JulianKnodt Oct 5, 2020
5aba3da
Update match branches
JulianKnodt Oct 5, 2020
9fde038
Update interpret step
JulianKnodt Nov 7, 2020
0686d5d
Update cranelift
JulianKnodt Dec 29, 2020
8eb6a16
Replace todos with impls
JulianKnodt Jan 23, 2021
ed665d2
Change CopyNonOverlapping::codegen_ssa
JulianKnodt Jan 23, 2021
250b7b7
Build StKind::CopyOverlapping
JulianKnodt Jan 23, 2021
aff18fa
Switch to changing cp_non_overlap in tform
JulianKnodt Jan 23, 2021
1dda668
Clean up todos
JulianKnodt Feb 26, 2021
10a4c67
Add regression test for #75525
bugadani Mar 5, 2021
e64138c
use pat<no_top_alt> for patterns in let bindings
mark-i-m Feb 13, 2021
c946d1d
Bump libc dependency of std to 0.2.88.
de-vri-es Mar 3, 2021
95e096d
Change x64 size checks to not apply to x32.
hvdijk Mar 6, 2021
402a00a
clippy: fix or-pattern in let binding
mark-i-m Mar 8, 2021
469c030
Update CONTRIBUTING.md
henryboisdequin Mar 8, 2021
bf40ac6
Make opening sentence friendlier for new contributors
henrytheswimmer Mar 9, 2021
01c9141
Rollup merge of #77511 - JulianKnodt:st_kind_cpy, r=oli-obk
m-ou-se Mar 9, 2021
ad89b9e
Rollup merge of #81127 - hanmertens:binary_heap_sift_down_perf, r=dto…
m-ou-se Mar 9, 2021
d3f7b9a
Rollup merge of #81879 - imbrem:make-reverse-repr-transparent, r=m-ou-se
m-ou-se Mar 9, 2021
8684eb9
Rollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkov
m-ou-se Mar 9, 2021
bfa0873
Rollup merge of #82731 - de-vri-es:bump-libc-for-std, r=Mark-Simulacrum
m-ou-se Mar 9, 2021
5574680
Rollup merge of #82799 - bugadani:codegen-tests, r=nagisa
m-ou-se Mar 9, 2021
9c400ba
Rollup merge of #82841 - hvdijk:x32, r=joshtriplett
m-ou-se Mar 9, 2021
07d5de3
Rollup merge of #82887 - henryboisdequin:improve-contributing-md, r=j…
m-ou-se Mar 9, 2021
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
Prev Previous commit
Next Next commit
Update cranelift
  • Loading branch information
JulianKnodt committed Mar 1, 2021
commit 0686d5d4c3213df906f2d67f90f9eefe563eb2c4
10 changes: 10 additions & 0 deletions compiler/rustc_codegen_cranelift/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,16 @@ fn codegen_stmt<'tcx>(
}
}
StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"),
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
src,
dst,
count,
}) => {
let dst = codegen_operand(fx, dst).load_scalar(fx);
let src = codegen_operand(fx, src).load_scalar(fx);
let count = codegen_operand(fx, count).load_scalar(fx);
fx.bcx.call_memcpy(fx.cx.module.target_config(), dst, src, count);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
#![warn(unreachable_pub)]
#![feature(box_patterns)]

#[cfg(feature = "jit")]
extern crate libc;
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_codegen_ssa/src/mir/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,22 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
mir::StatementKind::CopyNonOverlapping(box mir::CopyNonOverlapping {
ref src,
ref dst,
ref size,
ref count,
}) => {
let dst_val = self.codegen_operand(&mut bx, dst);
let src_val = self.codegen_operand(&mut bx, src);
let size_val = self.codegen_operand(&mut bx, size);
let size = size_val.immediate_or_packed_pair(&mut bx);
let count_val = self.codegen_operand(&mut bx, count);
let count = count_val.immediate_or_packed_pair(&mut bx);
let dst = dst_val.immediate_or_packed_pair(&mut bx);
let src = src_val.immediate_or_packed_pair(&mut bx);
use crate::MemFlags;
let flags =
(!MemFlags::UNALIGNED) & (!MemFlags::VOLATILE) & (!MemFlags::NONTEMPORAL);
let flags = MemFlags::empty();
bx.memcpy(
dst,
dst_val.layout.layout.align.pref,
src,
src_val.layout.layout.align.pref,
size,
count,
flags,
);
bx
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1641,8 +1641,10 @@ impl Debug for Statement<'_> {
CopyNonOverlapping(box crate::mir::CopyNonOverlapping {
ref src,
ref dst,
ref size,
}) => write!(fmt, "copy_nonoverlapping(src={:?}, dst={:?}, size={:?})", src, dst, size),
ref count,
}) => {
write!(fmt, "copy_nonoverlapping(src={:?}, dst={:?}, count={:?})", src, dst, count)
}
Nop => write!(fmt, "nop"),
}
}
Expand All @@ -1658,7 +1660,8 @@ pub struct Coverage {
pub struct CopyNonOverlapping<'tcx> {
pub src: Operand<'tcx>,
pub dst: Operand<'tcx>,
pub size: Operand<'tcx>,
/// Number of elements to copy from src to dest, not bytes.
pub count: Operand<'tcx>,
}

///////////////////////////////////////////////////////////////////////////
Expand Down
14 changes: 4 additions & 10 deletions compiler/rustc_middle/src/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,11 @@ macro_rules! make_mir_visitor {
StatementKind::CopyNonOverlapping(box crate::mir::CopyNonOverlapping{
ref $($mutability)? src,
ref $($mutability)? dst,
ref $($mutability)? size,
ref $($mutability)? count,
}) => {
self.visit_operand(
src,
location
);
self.visit_operand(
dst,
location
);
self.visit_operand(size, location)
self.visit_operand(src, location);
self.visit_operand(dst, location);
self.visit_operand(count, location)
}
StatementKind::Nop => {}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/borrow_check/invalidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
ref src,
ref dst,
ref size,
ref count,
}) => {
self.consume_operand(location, src);
self.consume_operand(location, dst);
self.consume_operand(location, size);
self.consume_operand(location, count);
match dst {
Operand::Move(ref place) | Operand::Copy(ref place) => {
self.mutate_place(location, *place, Deep, JustWrite);
Expand Down
36 changes: 22 additions & 14 deletions compiler/rustc_mir/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,36 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}

// Call CopyNonOverlapping
CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping { dst, src, size }) => {
let size = self.eval_operand(size, None)?;
CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping { dst, src, count }) => {
let (src, size) = {
let src = self.eval_operand(src, None)?;
let size = src.layout.layout.size;
let mplace = *src.assert_mem_place(self);
let ptr = match mplace.ptr {
Scalar::Ptr(ptr) => ptr,
_ => panic!(),
};
(ptr, size)
};

let dst = {
let dst = self.eval_operand(dst, None)?;
let mplace = *dst.assert_mem_place(self);
match mplace.ptr {
Scalar::Ptr(ptr) => ptr,
_ => panic!(),
Scalar::Ptr(ptr) => ptr,
_ => panic!(),
}
};
let src = {
let src = self.eval_operand(src, None)?;
let mplace = *src.assert_mem_place(self);
match mplace.ptr {
Scalar::Ptr(ptr) => ptr,
_ => panic!(),
}

let count = self.eval_operand(count, None)?;
let count = self.read_immediate(count)?.to_scalar()?;
let count = if let Scalar::Int(i) = count {
core::convert::TryFrom::try_from(i).unwrap()
} else {
panic!();
};
// Not sure how to convert an MPlaceTy<'_, <M as Machine<'_, '_>>::PointerTag>
// to a pointer, or OpTy to a size
self.memory.copy(src, dst, size.layout.layout.size, /*nonoverlapping*/ true)?;

self.memory.copy_repeatedly(src, dst, size, count, /*nonoverlapping*/ true)?;
}

// Statements we do not track.
Expand Down
Loading