1
Fork 0
rust/compiler/rustc_mir_transform/src
bors 68c8fdaac0 Auto merge of #108293 - Jarcho:mut_analyses, r=eholk
Take MIR dataflow analyses by mutable reference

The main motivation here is any analysis requiring dynamically sized scratch memory to work. One concrete example would be pointer target tracking, where tracking the results of a dereference can result in multiple possible targets. This leads to processing multi-level dereferences requiring the ability to handle a changing number of potential targets per step. A (simplified) function for this would be `fn apply_deref(potential_targets: &mut Vec<Target>)` which would use the scratch space contained in the analysis to send arguments and receive the results.

The alternative to this would be to wrap everything in a `RefCell`, which is what `MaybeRequiresStorage` currently does. This comes with a small perf cost and loses the compiler's guarantee that we don't try to take multiple borrows at the same time.

For the implementation:
* `AnalysisResults` is an unfortunate requirement to avoid an unconstrained type parameter error.
* `CloneAnalysis` could just be `Clone` instead, but that would result in more work than is required to have multiple cursors over the same result set.
* `ResultsVisitor` now takes the results type on in each function as there's no other way to have access to the analysis without cloning it. This could use an associated type rather than a type parameter, but the current approach makes it easier to not care about the type when it's not necessary.
* `MaybeRequiresStorage` now no longer uses a `RefCell`, but the graphviz formatter now does. It could be removed, but that would require even more changes and doesn't really seem necessary.
2023-06-08 23:58:44 +00:00
..
coverage Rollup merge of #111121 - Zalathar:ra-false-positive, r=jackh726 2023-05-24 21:36:56 +02:00
inline EarlyBinder::new -> EarlyBinder::bind 2023-05-29 13:46:10 +02:00
abort_unwinding_calls.rs Add UnwindAction::Terminate 2023-04-06 09:34:16 +01:00
add_call_guards.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
add_moves_for_packed_drops.rs Remove DesugaringKind::Replace. 2023-05-25 17:40:46 +00:00
add_retag.rs Spelling - compiler 2023-04-17 16:09:18 -04:00
check_alignment.rs Exclude Rvalue::AddressOf for raw pointer deref alignment checks 2023-05-27 14:54:15 -04:00
check_const_item_mutation.rs Migrate mir_transform to translatable diagnostics 2023-05-02 16:24:18 +01:00
check_packed_ref.rs Migrate mir_transform to translatable diagnostics 2023-05-02 16:24:18 +01:00
check_unsafety.rs Separate AnonConst from ConstBlock in HIR. 2023-06-02 21:25:18 +00:00
cleanup_post_borrowck.rs Actually keep PlaceMention if requested. 2023-04-21 21:34:59 +00:00
const_debuginfo.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
const_goto.rs Enable ConstGoto pass by default. 2023-05-29 11:10:53 +00:00
const_prop.rs Auto merge of #111677 - fee1-dead-contrib:rustc_const_eval-translatable, r=oli-obk,RalfJung 2023-06-02 05:11:49 +00:00
const_prop_lint.rs fix diagnostic message 2023-06-01 14:45:19 +00:00
copy_prop.rs unique borrows are mutating uses 2023-05-29 17:15:48 +02:00
ctfe_limit.rs Simplify back-edge logic. 2023-05-17 12:18:55 +00:00
dataflow_const_prop.rs Take MIR dataflow analyses by mutable reference. 2023-05-18 17:46:39 -04:00
dead_store_elimination.rs Actually keep PlaceMention if requested. 2023-04-21 21:34:59 +00:00
deduce_param_attrs.rs allow mutating function args through &raw const 2023-05-13 00:00:51 +02:00
deduplicate_blocks.rs Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
deref_separator.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
dest_prop.rs Actually keep PlaceMention if requested. 2023-04-21 21:34:59 +00:00
dump_mir.rs Profile MIR passes. 2023-05-15 20:27:12 +00:00
early_otherwise_branch.rs Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
elaborate_box_derefs.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
elaborate_drops.rs Remove DesugaringKind::Replace. 2023-05-25 17:40:46 +00:00
errors.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
ffi_unwind_calls.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
function_item_references.rs EarlyBinder::new -> EarlyBinder::bind 2023-05-29 13:46:10 +02:00
generator.rs Auto merge of #108293 - Jarcho:mut_analyses, r=eholk 2023-06-08 23:58:44 +00:00
inline.rs Only check inlining counter after recusing. 2023-06-03 12:29:49 +00:00
instsimplify.rs Stop turning transmutes into discriminants in mir-opt 2023-05-14 11:46:07 -07:00
large_enums.rs Use param_env_reveal_all_normalized in MIR opts. 2023-04-23 10:04:41 +00:00
lib.rs Enable SeparateConstSwitch by default. 2023-05-29 10:31:01 +00:00
lower_intrinsics.rs Lower unchecked_{div, rem} to BinOp::{Div, Rem} 2023-06-01 00:05:55 -07:00
lower_slice_len.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
match_branches.rs Try enabling MatchBranchSimplification 2023-05-27 13:50:13 -04:00
multiple_return_terminators.rs Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
normalize_array_len.rs Do not consider borrowed Freeze locals as SSA. 2023-05-09 17:59:35 +00:00
nrvo.rs Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
pass_manager.rs Profile MIR passes. 2023-05-15 20:27:12 +00:00
prettify.rs PR feedback: better comments and debug asserts 2023-05-21 17:48:37 -07:00
ref_prop.rs Do not ICE on deeply nested borrows. 2023-05-13 10:29:05 +00:00
remove_noop_landing_pads.rs Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
remove_place_mention.rs Actually keep PlaceMention if requested. 2023-04-21 21:34:59 +00:00
remove_storage_markers.rs Make MIR basic blocks field public 2022-07-07 08:11:49 +02:00
remove_uninit_drops.rs Move mir::Fieldabi::FieldIdx 2023-03-28 22:22:37 -07:00
remove_unneeded_drops.rs Make MIR basic blocks field public 2022-07-07 08:11:49 +02:00
remove_zsts.rs Generalize operation. 2023-03-13 18:22:55 +00:00
required_consts.rs Only rewrite valtree-constants to patterns and keep other constants opaque 2023-05-31 14:02:57 +00:00
reveal_all.rs Also reveal constants before MIR opts. 2023-04-23 10:04:41 +00:00
separate_const_switch.rs Enable SeparateConstSwitch by default. 2023-05-29 10:31:01 +00:00
shim.rs cleanup some skip_binder -> subst_identity 2023-06-05 18:40:36 -06:00
simplify.rs Profile MIR passes. 2023-05-15 20:27:12 +00:00
simplify_branches.rs Use param_env_reveal_all_normalized in MIR opts. 2023-04-23 10:04:41 +00:00
simplify_comparison_integral.rs Use param_env_reveal_all_normalized in MIR opts. 2023-04-23 10:04:41 +00:00
sroa.rs Enable ScalarReplacementOfAggregates 2023-05-31 19:18:16 -04:00
ssa.rs unique borrows are mutating uses 2023-05-29 17:15:48 +02:00
uninhabited_enum_branching.rs Use param_env_reveal_all_normalized in MIR opts. 2023-04-23 10:04:41 +00:00
unreachable_prop.rs Fix typos in compiler 2023-04-10 22:02:52 +02:00