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 10 pull requests #64826

Closed
wants to merge 46 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c015927
Fix ICE in rustdoc when merging generic and where bounds in the case …
Nashenas88 Aug 27, 2019
09f6b44
Simplify some code in rustdoc's simplify
Nashenas88 Aug 27, 2019
143b83a
Add regression test for issue, apply suggestion to convert to assert_eq
Nashenas88 Aug 28, 2019
612ef5f
add new tests for re_rebalance_coherence
nikomatsakis Sep 12, 2019
e69d1b6
change to check-pass
nikomatsakis Sep 13, 2019
3f004a1
Fix re-rebalance coherence implementation for fundamental types
weiznich Sep 17, 2019
a9c38d9
Add more tests
weiznich Sep 18, 2019
31b3012
Split line to fix tidy
weiznich Sep 18, 2019
3ee2920
Fix some unused variable warnings
weiznich Sep 22, 2019
d2762ac
Differentiate AArch64 bare-metal targets between hf and non-hf.
andre-richter Sep 18, 2019
2666ae5
Remove whitespace from testname
weiznich Sep 23, 2019
9249a73
More path name fixes
weiznich Sep 24, 2019
5122091
Turn `walk_parent_nodes` method into an iterator
estebank Sep 26, 2019
0ec4513
Fix format macro expansions spans to be macro-generated
rinon Sep 25, 2019
dd38a0f
update rtpSpawn's parameters type(It's prototype has been updated in …
bpangWR Sep 26, 2019
ab86cec
Account for tail expressions when pointing at return type
estebank Sep 26, 2019
7f318f6
[const-prop] Replace `eval_place()` with use of `InterpCx`
wesleywiser Sep 4, 2019
1a78e66
[const-prop] Replace `Use` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
570748d
[const-prop] Replace `Cast` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
243f99e
[const-prop] Replace `NullaryOp` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
0162021
[const-prop] Replace most `UnaryOp` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
233925d
[const-prop] Replace `CheckedBinaryOp` handling with use of `InterpCx`
wesleywiser Sep 9, 2019
bf770f9
[const-prop] Replace some `Binaryp` handling with use of `InterpCx`
wesleywiser Sep 10, 2019
82f38c4
[const-prop] Replace `Ref` handling with use of `InterpCx`
wesleywiser Sep 11, 2019
0d09424
Don't run the ConstProp MIR pass on generators
wesleywiser Sep 13, 2019
0cf9c5b
Respond to code review feedback and fix tidy
wesleywiser Sep 13, 2019
59f2e13
Move Ref-from-arg checking from `step.rs` to `const_prop.rs`
wesleywiser Sep 14, 2019
c8336f3
Work around for #64506
wesleywiser Sep 17, 2019
9b4fae7
Introduce a `ConstPropMachine`
wesleywiser Sep 25, 2019
737fb99
Allow reading non-mutable statics in const prop
wesleywiser Sep 25, 2019
377a70d
Fix div_duration() marked as stable by mistake
JMS55 Sep 26, 2019
c81d359
Merge pull request #30 from Wind-River/update
n-salim Sep 26, 2019
e9aa0e7
Use existing Handler to print query stack
Aaron1011 Sep 26, 2019
97906bc
Add note about global state in try_print_query_stack
Aaron1011 Sep 26, 2019
fdeb4ca
review comments
estebank Sep 26, 2019
821ff46
Include message on tests that should panic
kungfukennyg Sep 24, 2019
65af1ff
Rollup merge of #63937 - Nashenas88:rustdoc_57180, r=GuillaumeGomez
Centril Sep 27, 2019
931b795
Rollup merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obk
Centril Sep 27, 2019
0286ed0
Rollup merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, …
Centril Sep 27, 2019
daa632b
Rollup merge of #64589 - andre-richter:aarch64_bare_metal, r=Amanieu
Centril Sep 27, 2019
9c1b008
Rollup merge of #64745 - kennethbgoodin:should-panic-msg, r=varkor
Centril Sep 27, 2019
b0bfef1
Rollup merge of #64793 - immunant:format_spans, r=matthewjasper
Centril Sep 27, 2019
19f99b8
Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Centril Sep 27, 2019
ea31935
Rollup merge of #64802 - estebank:walk-parents-iterator, r=matthewjasper
Centril Sep 27, 2019
c02e798
Rollup merge of #64815 - JMS55:patch-1, r=jonas-schievink
Centril Sep 27, 2019
51f7b2b
Rollup merge of #64818 - Wind-River:master, r=alexcrichton
Centril Sep 27, 2019
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
[const-prop] Replace NullaryOp handling with use of InterpCx
  • Loading branch information
wesleywiser committed Sep 26, 2019
commit 243f99ebc0106efcd7da5c6c44dff9fd34bb40a4
28 changes: 7 additions & 21 deletions src/librustc_mir/transform/const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,15 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
) -> Option<Const<'tcx>> {
let span = source_info.span;
match *rvalue {
Rvalue::Repeat(..) |
Rvalue::Aggregate(..) |
Rvalue::NullaryOp(NullOp::Box, _) |
Rvalue::Discriminant(..) => None,

Rvalue::Use(_) |
Rvalue::Len(_) |
Rvalue::Cast(..) => {
Rvalue::Cast(..) |
Rvalue::NullaryOp(..) => {
self.use_ecx(source_info, |this| {
this.ecx.eval_rvalue_into_place(rvalue, place)?;
this.ecx.eval_place_to_op(place, Some(place_layout))
Expand All @@ -317,19 +323,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
let mplace = src.try_as_mplace().ok()?;
Some(ImmTy::from_scalar(mplace.ptr.into(), place_layout).into())
},
Rvalue::Repeat(..) |
Rvalue::Aggregate(..) |
Rvalue::NullaryOp(NullOp::Box, _) |
Rvalue::Discriminant(..) => None,

Rvalue::NullaryOp(NullOp::SizeOf, ty) => {
type_size_of(self.tcx, self.param_env, ty).and_then(|n| Some(
ImmTy::from_uint(
n,
self.tcx.layout_of(self.param_env.and(self.tcx.types.usize)).ok()?,
).into()
))
}
Rvalue::UnaryOp(op, ref arg) => {
let def_id = if self.tcx.is_closure(self.source.def_id()) {
self.tcx.closure_base_def_id(self.source.def_id())
Expand Down Expand Up @@ -515,14 +509,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
}
}

fn type_size_of<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
ty: Ty<'tcx>,
) -> Option<u64> {
tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes())
}

struct CanConstProp {
can_const_prop: IndexVec<Local, bool>,
// false at the beginning, once set, there are not allowed to be any more assignments
Expand Down