bors
0fd7ce99b0
Auto merge of #116010 - RalfJung:more-typed-immediates, r=oli-obk
...
interpret: more consistently use ImmTy in operators and casts
The diff in src/tools/miri/src/shims/x86/sse2.rs should hopefully suffice to explain why this is nicer. :)
2023-09-21 14:02:55 +00:00
Ralf Jung
c94410c145
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const
2023-09-21 08:12:30 +02:00
Ralf Jung
da08a3f40c
interpret: more consistently use ImmTy in operators and casts
2023-09-20 21:57:54 +02:00
Ralf Jung
5a0a1ff0cd
move ConstValue into mir
...
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19 11:11:02 +02:00
Ralf Jung
0f8908da27
cleanup op_to_const a bit; rename ConstValue::ByRef → Indirect
2023-09-14 07:27:30 +02:00
Ralf Jung
551f481ffb
use AllocId instead of Allocation in ConstValue::ByRef
2023-09-14 07:26:24 +02:00
Camille GILLOT
d0cba3df97
Do not fetch type to check generator.
2023-09-12 20:17:55 +00:00
Camille GILLOT
108decec53
Do not clone body for ConstProp.
2023-09-12 20:17:55 +00:00
Camille GILLOT
32fe00ae85
Reuse CollectAndPatch for normal ConstProp.
2023-09-12 20:17:55 +00:00
Camille GILLOT
054ed8e7eb
Introduce Machine::POST_MONO_CHECKS.
2023-09-12 20:17:52 +00:00
Camille GILLOT
24adf07e5f
Reuse throw_machine_stop_str! macro.
2023-09-11 16:29:41 +00:00
Ralf Jung
fa5f13775a
interpret: make MemPlace, Place, Operand types private to the interpreter
2023-09-04 17:53:38 +02:00
Ralf Jung
a09df43d9f
move marking-locals-live out of push_stack_frame, so it happens with argument passing
...
this entirely avoids even creating unsized locals in Immediate::Uninitialized state
2023-08-30 13:46:54 +02:00
Ralf Jung
ac3bca24b7
interpret: have assert_* intrinsics call the panic machinery instead of a direct abort
2023-08-20 15:52:40 +02:00
Camille GILLOT
4a177406ee
Inline should_const_prop.
2023-07-20 21:30:51 +00:00
Camille GILLOT
3f708add2f
Remove visit_terminator.
2023-07-20 21:30:51 +00:00
Camille GILLOT
ccfa9af29d
Propagate ScalarPair for any type.
2023-07-20 21:30:51 +00:00
Camille GILLOT
895e2159f8
Also propagate ScalarPair operands.
2023-07-20 21:30:51 +00:00
Camille GILLOT
12a2edd149
Always propagate into operands.
2023-07-20 21:30:51 +00:00
Mahdi Dibaiee
e55583c4b8
refactor(rustc_middle): Substs -> GenericArg
2023-07-14 13:27:35 +01:00
Ralf Jung
dd453a6a99
miri: protect Move() function arguments during the call
2023-07-11 21:59:01 +02:00
Rémy Rakic
4215859617
make const-prop use cached RPO
2023-06-14 20:08:04 +00:00
bors
33c3d10128
Auto merge of #111677 - fee1-dead-contrib:rustc_const_eval-translatable, r=oli-obk,RalfJung
...
Use translatable diagnostics in `rustc_const_eval`
This PR:
* adds a `no_span` parameter to `note` / `help` attributes when using `Subdiagnostic` to allow adding notes/helps without using a span
* has minor tweaks and changes to error messages
2023-06-02 05:11:49 +00:00
bors
789dd0b2a2
Auto merge of #112040 - cjgillot:separate-const-switch, r=oli-obk
...
Enable ConstGoto and SeparateConstSwitch passes by default
These 2 passes implement a limited form of jump-threading.
Filing this PR to see if enabling them would be lighter than https://github.com/rust-lang/rust/pull/107009 .
2023-06-01 16:04:40 +00:00
Deadbeef
f6c2bc5c24
fix diagnostic message
2023-06-01 14:45:19 +00:00
Deadbeef
f964b46451
improve debug message by eagerly translating
2023-06-01 14:45:19 +00:00
Deadbeef
4f83717cf7
Use translatable diagnostics in rustc_const_eval
2023-06-01 14:45:18 +00:00
Camille GILLOT
f74695b010
Document handling of StorageDead.
2023-05-31 17:28:24 +00:00
lcnr
cfd0623411
unique borrows are mutating uses
2023-05-29 17:15:48 +02:00
Camille GILLOT
48786886fb
Visit bodies in RPO for const-prop.
2023-05-29 10:31:01 +00:00
Camille GILLOT
cc4d1e581e
Stop marking locals as dead in ConstProp.
2023-05-29 10:31:01 +00:00
Camille GILLOT
a8988519d5
Propagate PlaceElem::Index.
2023-05-07 11:10:52 +00:00
Camille GILLOT
1ffe9059c3
Reject borrows of projections in ConstProp.
2023-05-04 21:51:44 +00:00
Matthias Krüger
0ac8ebdf11
Rollup merge of #110826 - cjgillot:place-mention-use, r=JakobDegen,lcnr
...
Make PlaceMention a non-mutating use.
Fixes https://github.com/rust-lang/rust/issues/110781
r? `@JakobDegen`
I don't agree with your statement in https://github.com/rust-lang/rust/issues/110781#issuecomment-1520841434 . I suggest that we start fixing `PlaceContext` to be accurate enough for optimizations to use it. This structure is very convenient to use in visitors, and we perhaps have an opportunity to make it less of a footgun.
2023-05-04 19:18:19 +02:00
bors
5133e15459
Auto merge of #109521 - tmiasko:const-prop-validation, r=wesleywiser
...
Don't validate constants in const propagation
Validation is neither necessary nor desirable.
The constant validation is already omitted at mir-opt-level >= 3, so there there are not changes in MIR test output (the propagation of invalid constants is covered by an existing test in tests/mir-opt/const_prop/invalid_constant.rs).
2023-05-02 03:42:37 +00:00
Camille GILLOT
9325a254f0
Make PlaceMention a non-mutating use.
2023-04-29 16:14:33 +00:00
bors
6ce22733b9
Auto merge of #110882 - BoxyUwU:rename-some-ty-flags, r=compiler-errors
...
rename `NEEDS_SUBST` and `NEEDS_INFER`
implements rust-lang/compiler-team#617
2023-04-27 09:55:37 +00:00
Boxy
842419712a
rename needs_subst to has_param
2023-04-27 08:35:19 +01:00
bors
8b8110e146
Auto merge of #110728 - cjgillot:no-false-optes, r=oli-obk
...
Do not bother optimizing impossible functions.
This is currently checked by `ConstProp`, but I see no reason to restrict it to ConstProp only.
2023-04-27 04:29:49 +00:00
Tomasz Miąsko
4adb8fbda0
Remove workaround for CastKind::Transmute from const prop
...
Since constants are no longer validated before propagation the
workaround is obsolete. Remove it.
2023-04-27 00:33:52 +02:00
Tomasz Miąsko
6a8fcdc597
Don't validate constants before propagation
...
Validation is neither necessary nor desirable.
The validation is already omitted at mir-opt-level >= 3, so there there
are not changes in MIR test output (the propagation of invalid constants
is covered by an existing test in tests/mir-opt/const_prop/invalid_constant.rs).
2023-04-27 00:32:03 +02:00
Maybe Waffle
e496fbec92
Split {Idx, IndexVec, IndexSlice} into their own modules
2023-04-24 13:53:35 +00:00
Camille GILLOT
15e5072147
Do not bother optimizing impossible functions.
2023-04-23 16:35:49 +00:00
Josh Soref
e09d0d2a29
Spelling - compiler
...
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com >
2023-04-17 16:09:18 -04:00
Camille GILLOT
22bf5fd848
Remove useless methods in visit.
2023-04-15 07:46:46 +00:00
Camille GILLOT
8a515aab76
Only enable ConstProp at mir-opt-level >= 2.
2023-04-15 07:46:46 +00:00
bors
f8ed97ecc1
Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naber
...
Make elaboration generic over input
Combines all the `elaborate_*` family of functions into just one, which is an iterator over the same type that you pass in (e.g. elaborating `Predicate` gives `Predicate`s, elaborating `Obligation`s gives `Obligation`s, etc.)
2023-04-09 00:18:10 +00:00
Michael Goulet
758bedc104
Make elaborator generic
2023-04-06 23:30:22 +00:00
Gary Guo
e3f2edc75b
Rename Abort terminator to Terminate
...
Unify terminology used in unwind action and terminator, and reflect
the fact that a nounwind panic is triggered instead of an immediate
abort is triggered for this terminator.
2023-04-06 09:34:16 +01:00
Gary Guo
5e6ed132fa
Add UnwindAction::Unreachable
...
This also makes eval machine's `StackPopUnwind`
redundant so that is replaced.
2023-04-06 09:34:16 +01:00