Commit Graph

30 Commits

Author SHA1 Message Date
bors 27885a94c6 Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`
2021-03-08 08:39:24 +00:00
Santiago Pastorino 004465c620
Bump one missing mir_opt_level 2021-03-05 17:13:58 -03:00
Santiago Pastorino 782c7b04cf
Bump all mir_opt_level 2 to 3 2021-03-05 17:13:57 -03:00
Santiago Pastorino f3b8920d4b
Bump all mir_opt_level 3 to 4 2021-03-05 17:13:56 -03:00
Santiago Pastorino 8152da22a1
Extract mir_opt_level to a method and use Option to be able to know if the value is provided or not 2021-03-05 17:13:56 -03:00
Oli Scherer 9a2362e5a9 Shrink the size of Rvalue by 16 bytes 2021-03-05 09:33:01 +00:00
Dániel Buga b97eb23cd0 Box generator-related Body fields 2021-03-01 08:32:49 +01:00
Ralf Jung d496bfc161 all InterpError allocate now, so adjust alloc-error-check 2021-02-20 19:01:25 +01:00
bors e7c23ab933 Auto merge of #82124 - tmiasko:op-ty-ref, r=oli-obk
Pass large interpreter types by reference, not value

r? `@ghost`
2021-02-20 10:20:42 +00:00
Tomasz Miąsko e190f0d974 Reduce size of InterpErrorInfo to 8 bytes 2021-02-17 08:57:06 +01:00
Tomasz Miąsko f2da425bff ./x.py fmt 2021-02-16 23:52:05 +01:00
Tomasz Miąsko fe0c46d07e Pass PlaceTy by reference not value 2021-02-16 23:52:05 +01:00
Tomasz Miąsko e915cf45dc Pass OpTy by reference not value 2021-02-16 23:52:05 +01:00
oli 0491e74dd9 Make sure that const prop does not produce unsilenceable lints after inlining 2021-01-23 16:51:23 +00:00
Dániel Buga 428f948096 Copy body span instead of querying it 2021-01-17 14:50:47 +01:00
bors 704e47f78b Auto merge of #78407 - oli-obk:ub_checkable_ctfe, r=RalfJung,pnkfelix
Make CTFE able to check for UB...

... by not doing any optimizations on the `const fn` MIR used in CTFE. This means we duplicate all `const fn`'s MIR now, once for CTFE, once for runtime. This PR is for checking the perf effect, so we have some data when talking about https://github.com/rust-lang/const-eval/blob/master/rfcs/0000-const-ub.md

To do this, we now have two queries for obtaining mir: `optimized_mir` and `mir_for_ctfe`. It is now illegal to invoke `optimized_mir` to obtain the MIR of a const/static item's initializer, an array length, an inline const expression or an enum discriminant initializer. For `const fn`, both `optimized_mir` and `mir_for_ctfe` work, the former returning the MIR that LLVM should use if the function is called at runtime. Similarly it is illegal to invoke `mir_for_ctfe` on regular functions.

This is all checked via appropriate assertions and I don't think it is easy to get wrong, as there should be no `mir_for_ctfe` calls outside the const evaluator or metadata encoding. Almost all rustc devs should keep using `optimized_mir` (or `instance_mir` for that matter).
2021-01-12 17:26:56 +00:00
Nym Seddon 06fd212d6a
Add ABI argument to `find_mir_or_eval_fn`
Add ABI argument for called function in `find_mir_or_eval_fn` and
`call_extra_fn`. Useful for comparing with expected ABI in interpreters.

Related to [miri/1631](https://github.com/rust-lang/miri/issues/1631)
2021-01-10 15:12:50 +00:00
oli caeb3d525d Move MIR body loading to a machine function 2021-01-04 21:40:38 +00:00
Vishnunarayan K I ff0ebd27a4 move interpret::MemoryKind::Heap to const eval 2020-12-03 21:42:11 +05:30
cjkenn 51c2218d1f move fuel checks to later points in instcombine and const_prop, add opt level flag to test 2020-11-18 08:49:46 -05:00
cjkenn 78a37f888a add optimization fuel checks to some mir passes 2020-11-16 18:09:10 -05:00
oli abacaf2aef `u128` truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
Oliver Scherer 362123dd75 Split the "raw integer bytes" part out of `Scalar` 2020-11-04 09:58:59 +00:00
Dylan DPC 54ea0f9ccd
Rollup merge of #78351 - RalfJung:validity-unsafe-cell, r=oli-obk
Move "mutable thing in const" check from interning to validity

This moves the check for mutable things (such as `UnsafeCell` or `&mut`) in a`const` from interning to validity. That means we can give more targeted error messages (pointing out *where* the problem lies), and we can simplify interning a bit.

Also fix the interning mode used for promoteds in statics.

r? @oli-obk
2020-10-28 01:21:18 +01:00
Ralf Jung 0e014be359 move UnsafeCell-in-const check from interning to validation 2020-10-26 08:56:54 +01:00
Eduard-Mihai Burtescu 6bc5eafbce rustc_mir: track inlined callees in SourceScopeData. 2020-10-21 04:43:56 +03:00
Dylan MacKenzie 6f61e71648 Remember the `MirSource` for each `Body` 2020-10-04 11:01:38 -07:00
Dániel Buga 90c7731f6c Enable const prop into operands at mir_opt_level=2 2020-09-23 19:03:10 +02:00
LeSeulArtichaut 3e14b684dd Change ty.kind to a method 2020-09-04 17:47:51 +02:00
mark 9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00