Commit Graph

1195 Commits

Author SHA1 Message Date
Ralf Jung 551f481ffb use AllocId instead of Allocation in ConstValue::ByRef 2023-09-14 07:26:24 +02:00
bors eb2446a57e Auto merge of #115820 - matthiaskrgr:rollup-kyglvpu, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #115736 (Remove `verbose_generic_activity_with_arg`)
 - #115771 (cleanup leftovers of const_err lint)
 - #115798 (add helper method for finding the one non-1-ZST field)
 - #115812 (Merge settings.css into rustdoc.css)
 - #115815 (fix: return early when has tainted in mir pass)
 - #115816 (Disabled socketpair for Vita)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-13 18:19:15 +00:00
Matthias Krüger 48d89a8759 Rollup merge of #115815 - bvanjoi:fix-115809, r=oli-obk
fix: return early when has tainted in mir pass

Fixes https://github.com/rust-lang/rust/issues/115809

As in #115643, `run_pass` is skipped if the body has tainted errors.

r? `@oli-obk`
2023-09-13 18:37:43 +02:00
Matthias Krüger 5dc37c1966 Rollup merge of #115736 - Zoxc:time-cleanup, r=wesleywiser
Remove `verbose_generic_activity_with_arg`

This removes `verbose_generic_activity_with_arg` and changes users to `generic_activity_with_arg`. This keeps the output of `-Z time` readable while these repeated events are still available with the self profiling mechanism.
2023-09-13 18:37:41 +02:00
bors 5adddad28c Auto merge of #115797 - cjgillot:const-prop-noclone, r=oli-obk
Do not clone the Body for ConstProp

~Based on https://github.com/rust-lang/rust/pull/115748 for the `POST_MONO_CHECKS` flag.~
2023-09-13 16:30:07 +00:00
bohan 7c53e87d55 fix: skip opt if body has tainted error 2023-09-13 23:07:39 +08:00
John Kåre Alsaker 9624c30965 Generate MIR pass names for profiling on the fly and pass the body DefId as argument 2023-09-13 13:41:19 +02:00
Ralf Jung 11a4a24d8e make the set of methods between our two Const types more consistent 2023-09-13 07:29:34 +02:00
Ralf Jung 6e4779ab17 make the eval() functions on our const types return the resulting value 2023-09-13 07:29:34 +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 8a3a0dd64e Store a ConstantKind in CollectAndPatch. 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 bcfe1a4bf2 Remove cur_span hook. 2023-09-11 16:29:42 +00:00
Camille GILLOT 24adf07e5f Reuse throw_machine_stop_str! macro. 2023-09-11 16:29:41 +00:00
Camille GILLOT d278ce126c Return ImmTy in discriminant_for_variant. 2023-09-11 16:29:41 +00:00
Camille GILLOT 1d6a32c920 Interpret Immediate::Uninit as Bottom. 2023-09-11 16:29:41 +00:00
Camille GILLOT b851e554dd Support CopyForDeref. 2023-09-11 16:29:41 +00:00
Camille GILLOT 82f0468009 Handle reading statics. 2023-09-11 16:29:41 +00:00
Camille GILLOT 6ad6b4381c Support non-scalar constants. 2023-09-11 16:29:41 +00:00
John Kåre Alsaker f742d88326 Remove verbose_generic_activity_with_arg 2023-09-10 17:47:16 +02:00
bors 3cd97ed3c3 Auto merge of #115612 - cjgillot:const-prop-int, r=oli-obk
Improvements to dataflow const-prop

Partially cherry-picked from https://github.com/rust-lang/rust/pull/110719

r? `@oli-obk`
cc `@jachris`
2023-09-08 15:32:54 +00:00
Guillaume Gomez 60327bb8b0 Rollup merge of #115643 - bvanjoi:fix-115203, r=RalfJung,oli-obk
fix: return early when has tainted in mir-lint

Fixes #115203

`a[..]` is of indeterminate size, it had been reported error during borrow check, therefore we skip the mir lint process.
2023-09-08 14:10:52 +02:00
bors 69ec43001a Auto merge of #115586 - Zalathar:query, r=cjgillot
coverage: Simplify the `coverageinfo` query

The `coverageinfo` query walks through a `mir::Body`'s statements to find the total number of coverage counter IDs and coverage expression IDs that have been used, as this information is needed by coverage codegen.

This PR makes 3 nice simplifications to that query:
- Extract a common iterator over coverage statements, shared by both coverage-related queries
- Simplify the query's visitor from two passes to just one pass
- Explicitly track the highest seen IDs in the visitor, and only convert to a count right at the end

I also updated some related comments. Some had been invalidated by these changes, while others had already been invalidated by previous coverage changes.
2023-09-08 02:24:55 +00:00
bohan 967410c640 fix: return ealry when has tainted in mir-lint 2023-09-08 09:30:23 +08:00
bors c5775a776f Auto merge of #115602 - oli-obk:lower_intrinsics, r=petrochenkov
Don't report any errors in `lower_intrinsics`.

Intrinsics should have been type checked earlier.

This is part of moving all mir-opt diagnostics early enough so that they are reliably emitted even in check builds: https://github.com/rust-lang/rust/issues/49292#issuecomment-1692212095
2023-09-07 11:02:54 +00:00
Zalathar e54204c8e9 coverage: In the visitor, track max counter/expression IDs without +1
This makes the visitor track the highest seen counter/expression IDs directly,
and only add +1 (to convert to a vector length) at the very end.
2023-09-07 18:06:13 +10:00
Zalathar f191b1c2fc coverage: Simplify the coverageinfo query to a single pass 2023-09-07 18:06:13 +10:00
Zalathar 3f549466a8 coverage: Extract a common iterator over a function's coverage statements
Both of the coverage queries can now use this one helper function to iterate
over all of the `mir::Coverage` payloads in the statements of a `mir::Body`.
2023-09-07 18:06:13 +10:00
bors 4e2116296c Auto merge of #115615 - matthiaskrgr:rollup-49fosdf, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #114511 (Remove the unhelpful let binding diag comes from FormatArguments)
 - #115473 (Add explanatory note to 'expected item' error)
 - #115574 (Replace `rustc_data_structures` dependency with `rustc_index` in `rustc_parse_format`)
 - #115578 (Clarify cryptic comments)
 - #115587 (fix #115348)
 - #115596 (A small change)
 - #115598 (Fix log formatting in bootstrap)
 - #115605 (Better Debug for `Ty` in smir)
 - #115614 (Fix minor grammar typo)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-06 18:16:06 +00:00
bors a5b2ac6906 Auto merge of #115252 - cjgillot:mir-composite, r=davidtwco
Represent MIR composite debuginfo as projections instead of aggregates

Composite debuginfo for MIR is currently represented as
```
debug name => Type { projection1 => place1, projection2 => place2 };
```
ie. a single `VarDebugInfo` object with that name, and its value a `VarDebugInfoContents::Composite`.

This PR proposes to reverse the representation to be
```
debug name.projection1 => place1;
debug name.projection2 => place2;
```
ie. multiple `VarDebugInfo` objects with each their projection.

This simplifies the handling of composite debuginfo by the compiler by avoiding weird nesting.

Based on https://github.com/rust-lang/rust/pull/115139
2023-09-06 16:10:11 +00:00
Camille GILLOT f96c6e04cb Propagate PlaceElem::Index. 2023-09-06 16:09:31 +00:00
Camille GILLOT fc63543792 Support array length. 2023-09-06 16:05:04 +00:00
Camille GILLOT 22986b72e5 Implement algebraic simplifications. 2023-09-06 15:57:50 +00:00
Camille GILLOT 74a967bcec Support a few more rvalues. 2023-09-06 15:52:06 +00:00
mojave2 df6e6a6d08 fix #115348 2023-09-06 17:46:46 +08:00
Oli Scherer 65f25fe194 Don't report any errors in lower_intrinsics. They should have been typecked before. 2023-09-06 09:38:15 +00:00
Camille GILLOT 7ef555d84a Support non-trivial scalars in ConstProp. 2023-09-05 21:25:41 +00:00
Camille GILLOT 09ce0f6ebc Remove type from ScalarTy. 2023-09-05 21:25:41 +00:00
bors a991861ec9 Auto merge of #115507 - cjgillot:relative-source-file, r=oli-obk
Use relative positions inside a SourceFile.

This allows to remove the normalization of start positions for hashing, and simplify allocation of global address space.

cc `@Zoxc`
2023-09-05 21:03:56 +00:00
Camille GILLOT 26c48e6f95 Refactor how MIR represents composite debuginfo. 2023-09-05 17:20:07 +00:00
Matthias Krüger 09974dfc69 Rollup merge of #115536 - RalfJung:interpreter-privacy, r=oli-obk
interpret: make MemPlace, Place, Operand types private to the interpreter

Outside the interpreter, only the typed versions should be used.
2023-09-05 15:16:50 +02:00
bors 8cfaf70c32 Auto merge of #115553 - matthiaskrgr:rollup-c0045hz, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #115353 (Emit error instead of ICE when optimized MIR is missing)
 - #115488 (Take `&mut Results` in `ResultsVisitor`)
 - #115492 (Allow `large_assignments` for Box/Arc/Rc initialization)
 - #115519 (Don't ICE on associated type projection without feature gate in new solver)
 - #115534 (Expose more information with DefId in smir)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-05 05:34:18 +00:00
Ralf Jung 7093903ba7 read_via_copy: don't prematurely optimize away the read 2023-09-04 18:27:34 +02:00
Ralf Jung fa5f13775a interpret: make MemPlace, Place, Operand types private to the interpreter 2023-09-04 17:53:38 +02:00
Camille GILLOT 258ace613d Use relative positions inside a SourceFile. 2023-09-03 12:56:10 +00:00
Jason Newcomb f686bd8949 Take &mut Results in ResultsVisitor 2023-09-02 19:35:51 -04:00
bors b1b244da65 Auto merge of #115194 - tmiasko:inline-always-encode-mir, r=compiler-errors
Fix inlining with -Zalways-encode-mir

Only inline functions that are considered eligible for inlining
by the reachability pass.

This constraint was previously indirectly enforced by only exporting MIR
of eligible functions, but that approach doesn't work with
-Zalways-encode-mir enabled.
2023-08-30 22:51:12 +00: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