Commit Graph

1106 Commits

Author SHA1 Message Date
Matthias Krüger f36a9b5e18 Rollup merge of #113534 - oli-obk:simd_shuffle_dehackify, r=workingjubilee
Forbid old-style `simd_shuffleN` intrinsics

Don't merge before https://github.com/rust-lang/packed_simd/pull/350 has made its way to crates.io

We used to support specifying the lane length of simd_shuffle ops by attaching the lane length to the name of the intrinsic (like `simd_shuffle16`). After this PR, you cannot do that anymore, and need to instead either rely on inference of the `idx` argument type or specify it as `simd_shuffle::<_, [u32; 16], _>`.

r? `@workingjubilee`
2023-08-04 07:25:45 +02:00
Michael Goulet 3c9549b349 Explicitly don't inline user-written rust-call fns 2023-08-03 18:35:56 +00:00
Michael Goulet 0391af0e1f Only unpack tupled args in inliner if we expect args to be unpacked 2023-08-03 18:35:56 +00:00
Oli Scherer 4457ef2c6d Forbid old-style simd_shuffleN intrinsics 2023-08-03 09:29:00 +00:00
Michael Goulet 99969d282b Use upvar_tys in more places, make it a list 2023-08-01 23:19:31 +00:00
Zalathar 3920e07f0b Make coverage counter IDs count up from 0, not 1
Operand types are now tracked explicitly, so there is no need to reserve ID 0
for the special always-zero counter.

As part of the renumbering, this change fixes an off-by-one error in the way
counters were counted by the `coverageinfo` query. As a result, functions
should now have exactly the number of counters they actually need, instead of
always having an extra counter that is never used.
2023-08-01 11:29:55 +10:00
Zalathar f103db894f Make coverage expression IDs count up from 0, not down from u32::MAX
Operand types are now tracked explicitly, so there is no need for expression
IDs to avoid counter IDs by descending from `u32::MAX`. Instead they can just
count up from 0, and can be used directly as indices when necessary.
2023-08-01 11:29:55 +10:00
Zalathar 1a014d42f4 Replace ExpressionOperandId with enum Operand
Because the three kinds of operand are now distinguished explicitly, we no
longer need fiddly code to disambiguate counter IDs and expression IDs based on
the total number of counters/expressions in a function.

This does increase the size of operands from 4 bytes to 8 bytes, but that
shouldn't be a big deal since they are mostly stored inside boxed structures,
and the current coverage code is not particularly size-optimized anyway.
2023-08-01 11:29:55 +10:00
Matthias Krüger 23815467a2 inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
Zalathar 8745fdc448 Replace a lazy RefCell<Option<T>> with OnceCell<T> 2023-07-28 12:55:13 +10:00
Matthias Krüger fa21a8c6f8 Rollup merge of #114075 - matthiaskrgr:fmt_args_rustc_3, r=wesleywiser
inline format!() args from rustc_codegen_llvm to the end (4)

r? `@WaffleLapkin`
2023-07-27 06:04:13 +02:00
Matthias Krüger c64ef5e070 inline format!() args from rustc_codegen_llvm to the end (4)
r? @WaffleLapkin
2023-07-25 23:20:28 +02:00
Ralf Jung 77ff1b83cd interpret: make read functions generic over operand type 2023-07-25 22:33:59 +02:00
Camille GILLOT b6cd7006e0 Reuse MIR validator for inliner. 2023-07-21 13:58:33 +00:00
bors 6b290367ec Auto merge of #113802 - cjgillot:check-debuginfo, r=compiler-errors
Substitute types before checking inlining compatibility.

Addresses https://github.com/rust-lang/rust/issues/112332 and https://github.com/rust-lang/rust/issues/113781

I don't have a minimal test, but I this seems to remove the ICE locally.

This whole pre-inlining validation mirrors the "real" MIR validation pass to verify that inlined MIR will still pass validation.
The debuginfo loop is added because MIR validation check projections in debuginfo.
Likewise, MIR validation only checks `is_subtype`, so there is no reason for a stronger check.

The types were not being substituted in `check_equal`, so we were not bailing out of inlining if the substituted MIR callee body would not pass validation.
2023-07-21 09:14:55 +00: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
Camille GILLOT 45ffe41d14 Substitute types before checking compatibility. 2023-07-19 12:38:15 +00:00
Camille GILLOT f5feb3e3ca Turn copy into moves during DSE. 2023-07-19 09:59:12 +00:00
bors 079e544174 Auto merge of #109025 - cjgillot:refprop-dbg, r=JakobDegen
Enable MIR reference propagation by default
2023-07-14 17:32:59 +00:00
Mahdi Dibaiee e55583c4b8 refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
Michael Woerister 457b787a52 Introduce ExtentUnord trait for collections that can safely consume UnordItems. 2023-07-14 10:10:15 +02:00
Mark Rousskov cc907f80b9 Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
Ralf Jung dd453a6a99 miri: protect Move() function arguments during the call 2023-07-11 21:59:01 +02:00
Camille GILLOT a5031d569e Call super for debuginfo. 2023-07-10 16:01:19 +00:00
Camille GILLOT b4c342edea Simplify visit_place. 2023-07-10 16:01:19 +00:00
Camille GILLOT 4de2d8fb66 Perform reference propagation earlier. 2023-07-10 16:01:18 +00:00
Camille GILLOT b74a144a5f Enable by default. 2023-07-10 16:01:18 +00:00
Nilstrieb 2beabbbf6f Rename adjustment::PointerCast and variants using it to PointerCoercion
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related
casts, when in reality their just used to share a some enum variants. Make it clear there these
are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-07 18:17:16 +02:00
Boxy 12138b8e5e Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
bors d5a74249c8 Auto merge of #112882 - DrMeepster:new_un_derefer, r=oli-obk
Rewrite `UnDerefer`

Currently, `UnDerefer` is used by drop elaboration to undo the effects of the `Derefer` pass. However, it just recreates the original places with derefs in the middle of the projection. Because `ProjectionElem::Deref` is intended to be removed completely in the future, this will not work forever.

This PR introduces a `deref_chain` method that returns the places behind `DerefTemp` locals in a place and rewrites the move path code to use this. In the process, `UnDerefer` was merged into `MovePathLookup`. Now that move paths use the same places as in the MIR, the other uses of `UnDerefer` no longer require it.

See #98145
cc `@ouz-a`
r? `@oli-obk`
2023-07-03 02:46:39 +00:00
DrMeepster 4fbd6d5af4 Merge un_derefer into MovePathLookup 2023-06-29 22:14:27 -07:00
bors 8aed93d912 Auto merge of #113116 - nnethercote:codegen-opts, r=oli-obk
A mish-mash of micro-optimizations

These were aimed at speeding up LLVM codegen, but ended up affecting other places as well.

r? `@bjorn3`
2023-06-30 00:35:19 +00:00
Nicholas Nethercote 7e786e81b0 Avoid cloning LocalDecls.
`DerefChecker` can just hold a reference instead. This avoids quite a
lot of allocations for some benchmarks.
2023-06-29 11:53:41 +10:00
bors bb95b7dcd6 Auto merge of #112307 - lcnr:operand-ref, r=compiler-errors
mir opt + codegen: handle subtyping

fixes #107205

the same issue was caused in multiple places:
- mir opts: both copy and destination propagation
- codegen: assigning operands to locals (which also propagates values)

I changed codegen to always update the type in the operands used for locals which should guard against any new occurrences of this bug going forward. I don't know how to make mir optimizations more resilient here. Hopefully the added tests will be enough to detect any trivially wrong optimizations going forward.
2023-06-28 00:41:37 +00:00
bors 6b46c996e1 Auto merge of #113105 - matthiaskrgr:rollup-rci0uym, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #112207 (Add trustzone and virtualization target features for aarch32.)
 - #112454 (Make compiletest aware of targets without dynamic linking)
 - #112628 (Allow comparing `Box`es with different allocators)
 - #112692 (Provide more context for `rustc +nightly -Zunstable-options` on stable)
 - #112972 (Make `UnwindAction::Continue` explicit in MIR dump)
 - #113020 (Add tests impl via obj unless denied)
 - #113084 (Simplify some conditions)
 - #113103 (Normalize types when applying uninhabited predicate.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-27 21:31:47 +00:00
Matthias Krüger d505582ce2 Rollup merge of #113084 - WaffleLapkin:less_map_or, r=Nilstrieb
Simplify some conditions

r? `@Nilstrieb`

Some things taken out of my `is_none_or` pr.
2023-06-27 22:10:15 +02:00
Matthias Krüger 526326e10d Rollup merge of #113079 - Zalathar:as-operand-id, r=oli-obk
Use `CoverageKind::as_operand_id` instead of manually reimplementing it

These two pieces of code are functionally equivalent to the `CoverageKind::as_operand_id` method that already exists, and is already used elsewhere in this file.

This slightly reduces the amount of code that manually pattern-matches on `CoverageKind`.
2023-06-27 17:48:46 +02:00
bors f42f19b6d3 Auto merge of #113078 - saethlin:mention-the-function, r=RalfJung
Mention the panic function in CheckAlignment

Per https://github.com/rust-lang/rust/pull/112599#discussion_r1242333935
r? `@RalfJung`
2023-06-27 09:43:37 +00:00
Maybe Waffle ef05533c39 Simplify some conditions 2023-06-27 07:40:47 +00:00
bors b5e51db16d Auto merge of #112938 - compiler-errors:clause-3, r=oli-obk
Migrate `TyCtxt::predicates_of` and `ParamEnv::caller_bounds` to `Clause`

The last big change in the series.

I will follow-up with additional filed issues once this PR lands:
- [ ] Investigate making `TypeFoldable<TyCtxt<'tcx>> for ty::Clause<'tcx>` implementation less weird: https://github.com/rust-lang/rust/blob/2efe09170530fa18e42ff05b8d9dd23f00b5c430/compiler/rustc_middle/src/ty/structural_impls.rs#L672
- [ ] Clean up the elaborator since it should only be emitting child clauses, not predicates
- [ ] Rename identifiers like `pred` and `predicates` to `clause` if they're actually clauses around the codebase
- [ ] Validate that all of the `ToPredicate` impls are acutally still needed, or prune them if they're not

r? `@ghost` until the other branch lands
2023-06-27 03:14:45 +00:00
Zalathar fbb2079a24 Use CoverageKind::as_operand_id instead of manually reimplementing it 2023-06-27 12:51:42 +10:00
Ben Kimock cdaac8799b Mention the panic function in CheckAlignment 2023-06-26 22:20:41 -04:00
bors b9ad9b78a2 Auto merge of #112693 - ericmarkmartin:use-more-placeref, r=spastorino
Use PlaceRef abstractions more often

Associated issue: https://github.com/rust-lang/rust/issues/80647

r? `@spastorino`
2023-06-27 00:34:49 +00:00
Michael Goulet fbdef58414 Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
Eric Mark Martin c07c10d1e4 use PlaceRef abstractions more consistently 2023-06-25 20:38:01 -04:00
Michael Goulet 46a650f4e0 Migrate item_bounds to ty::Clause 2023-06-22 18:34:23 +00:00