Commit Graph

641 Commits

Author SHA1 Message Date
jyn
cb6d033316 don't elide shared parts of types in diagnostics when --verbose is passed
this also changes some parts of lifetime printing, which previously were not gated behind `-Z verbose`
2023-12-24 16:47:18 -05:00
Camille GILLOT
2837727471 Replace legacy ConstProp by GVN. 2023-12-24 20:08:57 +00:00
Camille GILLOT
a03c972816 Enable GVN by default. 2023-12-24 20:08:57 +00:00
Tomasz Miąsko
ba430a36c0 Enable -Zlint-mir by default for mir-opt tests 2023-12-21 00:00:00 +00:00
bors
f704f3b93b Auto merge of #119112 - Nadrieril:remove-target_blocks-hack, r=matthewjasper
match lowering: Remove the `make_target_blocks` hack

This hack was introduced 4 years ago in [`a1d0266` (#60730)](a1d0266878) to improve LLVM optimization time, specifically noticed in the `encoding` benchmark. Measurements today indicate it is no longer needed.

r? `@matthewjasper`
2023-12-19 21:15:31 +00:00
jyn
b5d8361909 rename to verbose-internals 2023-12-19 13:35:37 -05:00
Nadrieril
31bad13f82 Remove the make_target_blocks hack
It was introduced 4 years ago in a1d0266878 to improve LLVM
optimization time. Measurements today indicate it is no longer needed.
2023-12-19 11:37:39 +01:00
Camille GILLOT
8022057ebb Avoid overflow in GVN constant indexing. 2023-12-17 19:50:38 +00:00
Tomasz Miąsko
ef1831a21f End locals' live range before suspending coroutine
State transforms retains storage statements for locals that are not
stored inside a coroutine. It ensures those locals are live when
resuming by inserting StorageLive as appropriate. It forgot to end the
storage of those locals when suspending, which is fixed here.

While the end of live range is implicit when executing return, it is
nevertheless useful for inliner which would otherwise extend the live
range beyond return.
2023-12-11 23:11:20 +01:00
bors
c71c246876 Auto merge of #118550 - cjgillot:filecheck-const-prop, r=Mark-Simulacrum
Add FileCheck annotations to const_prop tests

Unblocks https://github.com/rust-lang/rust/pull/116012
Advances https://github.com/rust-lang/rust/issues/116971
2023-12-10 03:00:58 +00:00
Ralf Jung
29c95e98e3 also print 'immutable' flag 2023-12-07 17:46:36 +01:00
Camille GILLOT
30a95b7c0a FileCheck while_let_loops. 2023-12-02 21:10:04 +00:00
Camille GILLOT
c00068e49f FileCheck tuple_literal_propagation. 2023-12-02 21:08:55 +00:00
Camille GILLOT
87522d0007 FileCheck return_place. 2023-12-02 21:08:12 +00:00
Camille GILLOT
a12027e128 FileCheck switch_int. 2023-12-02 21:06:48 +00:00
Camille GILLOT
19767eb7a6 FileCheck slice_len. 2023-12-02 21:06:38 +00:00
Camille GILLOT
3e90c1b434 FileCheck scalar_literal_propagation. 2023-12-02 21:02:42 +00:00
Camille GILLOT
f3743aec51 FileCheck repeat. 2023-12-02 21:01:48 +00:00
Camille GILLOT
343ef6a9cb FileCheck reify_fn_ptr. 2023-12-02 21:00:59 +00:00
Camille GILLOT
6baec3ccc2 FileCheck ref_deref. 2023-12-02 20:58:45 +00:00
Camille GILLOT
c8c9207e4c FileCheck read_immutable_static. 2023-12-02 20:56:26 +00:00
Camille GILLOT
45dd5d6bf3 FileCheck mutable_variable_unprop_assign. 2023-12-02 20:54:56 +00:00
Camille GILLOT
6a8eea8f5b FileCheck mutable_variable_aggregate_partial_read. 2023-12-02 20:51:23 +00:00
Camille GILLOT
d91bb5074e FileCheck mutable_variable_no_prop. 2023-12-02 20:50:00 +00:00
Camille GILLOT
3e169abc1b FileCheck mutable_variable_aggregate_mut_ref. 2023-12-02 20:49:50 +00:00
Camille GILLOT
03c5ad1549 FileCheck mutable_variable_aggregate. 2023-12-02 20:49:38 +00:00
Camille GILLOT
ea9f968333 FileCheck mutable_variable. 2023-12-02 20:49:28 +00:00
Camille GILLOT
902a3e2e75 FileCheck mult_by_zero. 2023-12-02 20:39:26 +00:00
Camille GILLOT
8e9b912c4c FileCheck issue_67019. 2023-12-02 20:38:07 +00:00
Camille GILLOT
ce9b1e23a5 FileCheck issue_66971. 2023-12-02 20:37:05 +00:00
Camille GILLOT
218d8ccf43 FileCheck inherit_overflow. 2023-12-02 20:31:27 +00:00
Camille GILLOT
6086dd6766 FileCheck indirect. 2023-12-02 20:29:47 +00:00
Camille GILLOT
bf5d114da8 FileCheck discriminant. 2023-12-02 20:28:33 +00:00
Camille GILLOT
043d29b58a FileCheck and rename const_prop_fails_gracefully. 2023-12-02 20:23:16 +00:00
Camille GILLOT
7f328d2a44 FileCheck checked_add. 2023-12-02 20:18:58 +00:00
Camille GILLOT
e6a1b77cd1 FileCheck cast. 2023-12-02 20:18:47 +00:00
Camille GILLOT
b8f2f63931 FileCheck boxes. 2023-12-02 20:18:21 +00:00
Camille GILLOT
3fc03948a8 FileCheck boolean_identities. 2023-12-02 20:18:14 +00:00
Camille GILLOT
e8e35c8127 FileCheck bad_op_unsafe_oob_for_slices. 2023-12-02 20:18:02 +00:00
Camille GILLOT
97f03cb898 FileCheck bad_op_mod_by_zero. 2023-12-02 20:17:49 +00:00
Camille GILLOT
0d5bc872a9 FileCheck bad_op_div_by_zero. 2023-12-02 20:17:37 +00:00
Camille GILLOT
9f01d9d1b6 FileCheck array_index. 2023-12-02 20:17:20 +00:00
Camille GILLOT
6564bac532 FileCheck aggregate. 2023-12-02 20:17:04 +00:00
Camille GILLOT
378abbc604 FileCheck address_of_pair. 2023-12-02 20:16:49 +00:00
bors
3f1e30a0a5 Auto merge of #118077 - calebzulawski:sync-portable-simd-2023-11-19, r=workingjubilee
Portable SIMD subtree update

Syncs nightly to the latest changes from rust-lang/portable-simd

r? `@rust-lang/libs`
2023-12-02 18:04:01 +00:00
Matthias Krüger
434232f7b2
Rollup merge of #118426 - aDotInTheVoid:const-wat, r=compiler-errors,cjgillot
ConstProp: Correctly remove const if unknown value assigned to it.

Closes #118328

The problematic sequence of MIR is:

```rust
          _1 = const 0_usize;
          _1 = const _; // This is an associated constant we can't know before monomorphization.
          _0 = _1;
```

1. When `ConstProp::visit_assign` happens on `_1 = const 0_usize;`, it records that `0x0usize` is the value for `_1`.
2. Next `visit_assign` happens on `_1 = const _;`. Because the rvalue `.has_param()`, it can't be const evaled.
3. Finaly, `visit_assign` happens on `_0 = _1;`. Here it would think the value of `_1` was `0x0usize` from step 1.

The solution is to remove consts when checking the RValue fails, as they may have contained values that should now be invalidated, as that local was overwritten.

This should probably be back-ported to beta. Stable is more iffy, as it's gone unidentified since 1.70, so I only think it's worthwhile if there's another reason for a 1.74.1 release anyway.
2023-11-29 12:34:50 +01:00
bors
b1e56deada Auto merge of #114841 - bvanjoi:fix-114814, r=cuviper
add track_caller for arith ops

Fixes #114814

`#[track_caller]` is works, r? `@scottmcm`
2023-11-29 00:47:25 +00:00
Alona Enraght-Moony
6e956c0a38 Rename and add another test 2023-11-28 23:17:28 +00:00
Alona Enraght-Moony
9121a41450 ConstProp: Remove const when rvalue check fails. 2023-11-28 22:15:11 +00:00
Alona Enraght-Moony
b1a6cf4a0e Precommit test for https://github.com/rust-lang/rust/issues/118328. 2023-11-28 15:12:46 +00:00
Caleb Zulawski
4d9607869a Update std::simd usage and test outputs 2023-11-26 09:02:25 -05:00
Gary Guo
2c03f21d1f Bless MIR tests 2023-11-26 00:14:18 +00:00
bohan
fc87d6e23d add track_caller for arith ops 2023-11-24 00:54:06 +08:00
Tomasz Miąsko
1be1c2ebcf Fix insertion of statements to be executed along return edge in inlining
Inlining creates additional statements to be executed along the return
edge: an assignment to the destination, storage end for temporaries.

Previously those statements where inserted directly into a call target,
but this is incorrect when the target has other predecessors.

Avoid the issue by creating a new dedicated block for those statements.
When the block happens to be redundant it will be removed by CFG
simplification that follows inlining.

Fixes #117355
2023-11-20 09:27:30 +01:00
George Bateman
661df4fd55
Remove option_payload_ptr; redundant to offset_of 2023-11-16 22:56:25 +00:00
bors
5526682702 Auto merge of #117330 - tmiasko:custom-mir-cleanup-blocks, r=cjgillot
Custom MIR: Support cleanup blocks

Cleanup blocks are declared with `bb (cleanup) = { ... }`.

`Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following:

* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`

Also support unwind resume and unwind terminate terminators:

* `UnwindResume()`
* `UnwindTerminate(reason)`
2023-11-14 08:53:25 +00:00
Tomasz Miąsko
78da577650 Custom MIR: Support cleanup blocks
Cleanup blocks are declared with `bb (cleanup) = { ... }`.

`Call` and `Drop` terminators take an additional argument describing the
unwind action, which is one of the following:

* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`

Also support unwind resume and unwind terminate terminators:

* `UnwindResume()`
* `UnwindTerminate(reason)`
2023-11-14 08:23:58 +01:00
Michael Goulet
7994b5849c Compute layout with spans for better cycle errors in coroutines 2023-11-13 02:22:25 +00:00
lcnr
92267c9794 update mir-opt tests 2023-11-08 22:55:29 +01:00
bors
992943dbae Auto merge of #117537 - GKFX:offset-of-enum-feature, r=cjgillot
Feature gate enums in offset_of

As requested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790815262, put enums in offset_of behind their own feature gate.

`@rustbot` label F-offset_of
2023-11-05 13:44:59 +00:00
bors
8acf40bd54 Auto merge of #117469 - cjgillot:filecheck-mir, r=Mark-Simulacrum
Add FileCheck annotations to a few MIR opt tests

const_debuginfo did not specify which passes were running.
const_prop_miscompile is renamed and moved to const_prop directory.
while_storage was broken.
2023-11-05 07:54:12 +00:00
George Bateman
7c09b99ebb
Feature gate enums in offset_of 2023-11-03 13:16:47 +00:00
bors
722b3eeb72 Auto merge of #117498 - matthiaskrgr:rollup-z7mg4ck, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #117298 (Recover from missing param list in function definitions)
 - #117373 (Avoid the path trimming ICE lint in error reporting)
 - #117441 (Do not assert in op_to_const.)
 - #117488 (Update minifier-rs version to 0.3.0)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-01 22:37:24 +00:00
bors
75b064d269 Auto merge of #117029 - rmehri01:mir_opt_filecheck_inline_tests, r=cjgillot
Add FileCheck annotations to MIR-opt inlining tests

Part of #116971, adds FileCheck annotations to MIR-opt tests in `tests/mir-opt/inline`.

I left out a few (such as `inline_cycle`) where it mentioned that the particular outcome of inlining isn't important, just that the inliner doesn't get stuck in an infinite loop.

r? cjgillot
2023-11-01 20:37:38 +00:00
Camille GILLOT
0f8f77fcc2 Rebase fallout. 2023-11-01 16:55:18 +00:00
Camille GILLOT
a2e151ca4b Make ui into mir-opt test. 2023-11-01 16:49:18 +00:00
Ryan Mehri
5f75326d74 fix spans for inline_couroutine panic-abort 2023-11-01 07:58:19 -07:00
bors
146dafa262 Auto merge of #114208 - GKFX:offset_of_enum, r=wesleywiser
Support enum variants in offset_of!

This MR implements support for navigating through enum variants in `offset_of!`, placing the enum variant name in the second argument to `offset_of!`. The RFC placed it in the first argument, but I think it interacts better with nested field access in the second, as you can then write things like

```rust
offset_of!(Type, field.Variant.field)
```

Alternatively, a syntactic distinction could be made between variants and fields (e.g. `field::Variant.field`) but I'm not convinced this would be helpful.

[RFC 3308 # Enum Support](https://rust-lang.github.io/rfcs/3308-offset_of.html#enum-support-offset_ofsomeenumstructvariant-field_on_variant)
Tracking Issue #106655.
2023-11-01 14:17:56 +00:00
Matthias Krüger
260e07b0cb
Rollup merge of #115626 - clarfonthey:unchecked-math, r=thomcc
Clean up unchecked_math, separate out unchecked_shifts

Tracking issue: #85122

Changes:

1. Remove `const_inherent_unchecked_arith` flag and make const-stability flags the same as the method feature flags. Given the number of other unsafe const fns already stabilised, it makes sense to just stabilise these in const context when they're stabilised.
2. Move `unchecked_shl` and `unchecked_shr` into a separate `unchecked_shifts` flag, since the semantics for them are unclear and they'll likely be stabilised separately as a result.
3. Add an `unchecked_neg` method exclusively to signed integers, under the `unchecked_neg` flag. This is because it's a new API and probably needs some time to marinate before it's stabilised, and while it *would* make sense to have a similar version for unsigned integers since `checked_neg` also exists for those there is absolutely no case where that would be a good idea, IMQHO.

The longer-term goal here is to prepare the `unchecked_math` methods for an FCP and stabilisation since they've existed for a while, their semantics are clear, and people seem in favour of stabilising them.
2023-11-01 11:29:41 +01:00
George Bateman
9d6ce61376
Update MIR tests for offset_of 2023-10-31 23:26:02 +00:00
George Bateman
e936416a8d
Support enum variants in offset_of! 2023-10-31 23:25:54 +00:00
Camille GILLOT
ac4d0965bb FileCheck const_prop_miscompile. 2023-10-31 22:56:02 +00:00
Camille GILLOT
e65ec7d8f1 FileCheck const_debuginfo. 2023-10-31 22:55:59 +00:00
Camille GILLOT
3d454707ab FileCheck while_storage. 2023-10-31 22:55:14 +00:00
Ryan Mehri
2fcb4d92b0 change inline_retag to after.mir 2023-10-31 11:58:20 -07:00
Camille GILLOT
ae2e21114b FileCheck uninhabited_enum_branching. 2023-10-31 11:44:23 +00:00
Camille GILLOT
cb918904fe Only emit != assumptions if the otherwise target is reachable. 2023-10-31 11:44:23 +00:00
Camille GILLOT
096196d5b0 Refactor UninhabitedEnumBranching to mark targets unreachable. 2023-10-31 11:44:23 +00:00
Camille GILLOT
0b13e636f5 Simplify assume of a constant. 2023-10-31 11:44:23 +00:00
Camille GILLOT
c748ac1f11 Replace SwitchInt to unreachable by an assumption. 2023-10-31 11:44:23 +00:00
Camille GILLOT
ed27cb0f49 Reorder passes. 2023-10-31 11:44:23 +00:00
bors
83c9732e0c Auto merge of #116270 - cjgillot:gvn-aggregate, r=oli-obk,RalfJung
See through aggregates in GVN

This PR is extracted from https://github.com/rust-lang/rust/pull/111344

The first 2 commit are cleanups to avoid repeated work. I propose to stop removing useless assignments as part of this pass, and let a later `SimplifyLocals` do it. This makes tests easier to read (among others).

The next 3 commits add a constant folding mechanism to the GVN pass, presented in https://github.com/rust-lang/rust/pull/116012. ~This pass is designed to only use global allocations, to avoid any risk of accidental modification of the stored state.~

The following commits implement opportunistic simplifications, in particular:
- projections of aggregates: `MyStruct { x: a }.x` gets replaced by `a`, works with enums too;
- projections of arrays: `[a, b][0]` becomes `a`;
- projections of repeat expressions: `[a; N][x]` becomes `a`;
- transform arrays of equal operands into a repeat rvalue.

Fixes https://github.com/rust-lang/miri/issues/3090

r? `@oli-obk`
2023-10-29 14:50:53 +00:00
bors
59bb9505bc Auto merge of #103208 - cjgillot:match-fake-read, r=oli-obk,RalfJung
Allow partially moved values in match

This PR attempts to unify the behaviour between `let _ = PLACE`, `let _: TY = PLACE;` and `match PLACE { _ => {} }`.
The logical conclusion is that the `match` version should not check for uninitialised places nor check that borrows are still live.

The `match PLACE {}` case is handled by keeping a `FakeRead` in the unreachable fallback case to verify that `PLACE` has a legal value.

Schematically, `match PLACE { arms }` in surface rust becomes in MIR:
```rust
PlaceMention(PLACE)
match PLACE {
  // Decision tree for the explicit arms
  arms,
  // An extra fallback arm
  _ => {
    FakeRead(ForMatchedPlace, PLACE);
    unreachable
  }
}
```

`match *borrow { _ => {} }` continues to check that `*borrow` is live, but does not read the value.
`match *borrow {}` both checks that `*borrow` is live, and fake-reads the value.

Continuation of ~https://github.com/rust-lang/rust/pull/102256~ ~https://github.com/rust-lang/rust/pull/104844~

Fixes https://github.com/rust-lang/rust/issues/99180 https://github.com/rust-lang/rust/issues/53114
2023-10-27 18:51:43 +00:00
bors
6f65201659 Auto merge of #113262 - Nilstrieb:rawr-casting, r=lcnr
Never consider raw pointer casts to be trival

HIR typeck tries to figure out which casts are trivial by doing them as
coercions and seeing whether this works. Since HIR typeck is oblivious
of lifetimes, this doesn't work for pointer casts that only change the
lifetime of the pointee, which are, as borrowck will tell you, not
trivial.

This change makes it so that raw pointer casts are never considered
trivial.

This also incidentally fixes the "trivial cast" lint false positive on
the same code. Unfortunately, "trivial cast" lints are now never emitted
on raw pointer casts, even if they truly are trivial. This could be
fixed by also doing the lint in borrowck for raw pointers specifically.

fixes #113257
2023-10-26 12:54:19 +00:00
Ryan Mehri
1ec10ec77f address review comments 2023-10-25 15:25:38 -07:00
Ryan Mehri
6ab66c3f37 FileCheck unwrap_unchecked 2023-10-25 15:25:38 -07:00
Ryan Mehri
3faf05b6e7 FileCheck unsized_argument 2023-10-25 15:25:38 -07:00
Ryan Mehri
6e047c07a6 FileCheck unchecked_shifts 2023-10-25 15:25:38 -07:00
Ryan Mehri
5cf65eb16a FileCheck issue_78442 2023-10-25 15:25:38 -07:00
Ryan Mehri
bb695977de FileCheck inline_scopes_parenting 2023-10-25 15:25:38 -07:00
Ryan Mehri
773dc62756 FileCheck inline_as_ref_as_mut 2023-10-25 15:25:38 -07:00
Ryan Mehri
1b9cb5d59b FileCheck inline_trait_method 2023-10-25 15:25:38 -07:00
Ryan Mehri
f7acf17945 FileCheck inline_trait_method_2 2023-10-25 15:25:38 -07:00
Ryan Mehri
25325667f2 FileCheck inline_specialization 2023-10-25 15:25:38 -07:00
Ryan Mehri
21a4c39cb8 FileCheck inline_retag 2023-10-25 15:25:38 -07:00
Ryan Mehri
3202d4e357 FileCheck inline_options 2023-10-25 15:25:38 -07:00
Ryan Mehri
de8255194a FileCheck inline_into_box_place 2023-10-25 15:25:38 -07:00
Ryan Mehri
19c36a96df FileCheck inline_instruction_set 2023-10-25 15:25:38 -07:00
Ryan Mehri
20e7caa737 FileCheck inline_coroutine 2023-10-25 15:25:38 -07:00
Ryan Mehri
d8f33ef93d FileCheck inline_diverging 2023-10-25 15:25:38 -07:00
Ryan Mehri
7ee05d24b5 FileCheck inline_closure 2023-10-25 15:22:01 -07:00
Ryan Mehri
5caee416a5 FileCheck inline_closure_captures 2023-10-25 15:22:01 -07:00
Ryan Mehri
9d61e6a4e4 FileCheck inline_closure_borrows_arg 2023-10-25 15:22:01 -07:00
Ryan Mehri
de56d2d9b2 FileCheck inline_box_fn 2023-10-25 15:22:01 -07:00
Ryan Mehri
22679cd36d FileCheck inline_any_operand 2023-10-25 15:22:01 -07:00
Ryan Mehri
f005d2325a FileCheck exponential_runtime 2023-10-25 15:22:01 -07:00
Ryan Mehri
76faae9cdc FileCheck dyn_trait 2023-10-25 15:22:01 -07:00
Ryan Mehri
9b3f5e1527 FileCheck dont_ice_on_generic_rust_call 2023-10-25 15:22:01 -07:00
Ryan Mehri
2f9aa7da9f FileCheck cycle 2023-10-25 15:22:01 -07:00
Ryan Mehri
2d0a34bb78 FileCheck caller_with_trivial_bound 2023-10-25 15:22:01 -07:00
Ryan Mehri
62fe807e3c FileCheck asm_unwind 2023-10-25 15:22:01 -07:00
Nilstrieb
b6657a8ad4 Never consider raw pointer casts to be trival
HIR typeck tries to figure out which casts are trivial by doing them as
coercions and seeing whether this works. Since HIR typeck is oblivious
of lifetimes, this doesn't work for pointer casts that only change the
lifetime of the pointee, which are, as borrowck will tell you, not
trivial.

This change makes it so that raw pointer casts are never considered
trivial.

This also incidentally fixes the "trivial cast" lint false positive on
the same code. Unfortunately, "trivial cast" lints are now never emitted
on raw pointer casts, even if they truly are trivial. This could be
fixed by also doing the lint in borrowck for raw pointers specifically.
2023-10-25 23:15:18 +02:00
Camille GILLOT
d80eb3a498 Verify that the alloc_id is Memory. 2023-10-25 17:59:30 +00:00
Matthias Krüger
a1ab16792b
Rollup merge of #117141 - tmiasko:inline-target-features, r=oli-obk
Require target features to match exactly during inlining

In general it is not correct to inline a callee with a target features
that are subset of the callee. Require target features to match exactly
during inlining.

The exact match could be potentially relaxed, but this would require
identifying specific feature that are allowed to differ, those that need
to match, and those that can be present in caller but not in callee.

This resolves MIR part of #116573. For other concerns with respect to
the previous implementation also see areInlineCompatible in LLVM.
2023-10-25 19:51:14 +02:00
Camille GILLOT
c4cc9ca060 Do not merge fn pointer casts. 2023-10-25 06:47:04 +00:00
Camille GILLOT
ac0228da59 FileCheck gvn. 2023-10-25 06:46:48 +00:00
Camille GILLOT
5e78b9cdb3 Disambiguate non-deterministic constants. 2023-10-25 06:46:48 +00:00
Camille GILLOT
dbf9ea30dd Transform large arrays into Repeat expressions when possible. 2023-10-25 06:46:48 +00:00
Camille GILLOT
80a5e8522d Extract simplify_aggregate. 2023-10-25 06:46:47 +00:00
Camille GILLOT
f110f22060 Simplify repeat expressions. 2023-10-25 06:46:47 +00:00
Camille GILLOT
48d2157a89 Simplify aggregate projections. 2023-10-25 06:46:47 +00:00
Camille GILLOT
692e528647 Simplify projections in GVN. 2023-10-25 06:46:47 +00:00
Camille GILLOT
38c86b0798 Evaluate computed values to constants. 2023-10-25 06:46:47 +00:00
Camille GILLOT
d28405972f Do not remove unused definitions inside GVN. 2023-10-25 06:46:45 +00:00
bors
df871fbf05 Auto merge of #115796 - cjgillot:const-prop-rvalue, r=oli-obk
Generate aggregate constants in DataflowConstProp.
2023-10-24 21:47:53 +00:00
Tomasz Miąsko
011b260cc8 Require target features to match exactly during inlining
In general it is not correct to inline a callee with a target features
that are subset of the callee. Require target features to match exactly
during inlining.

The exact match could be potentially relaxed, but this would require
identifying specific feature that are allowed to differ, those that need
to match, and those that can be present in caller but not in callee.

This resolves MIR part of #116573. For other concerns with respect to
the previous implementation also see areInlineCompatible in LLVM.
2023-10-24 22:49:15 +02:00
Tomasz Miąsko
b3cfd5bb04 Precommit target features compatibility test 2023-10-24 22:44:59 +02:00
Tomasz Miąsko
ff7bf792ce Migrate inline_compatibility.rs test to FileCheck 2023-10-24 22:19:44 +02:00
Camille GILLOT
ec28dc7aa7 Use PlaceMention for match scrutinees. 2023-10-24 15:30:17 +00:00
Camille GILLOT
9c85dfa1d7 Tweak test to avoid platform dependency. 2023-10-24 15:16:57 +00:00
bors
cd674d6179 Auto merge of #116300 - cjgillot:split-move, r=petrochenkov
Separate move path tracking between borrowck and drop elaboration.

The primary goal of this PR is to skip creating a `MovePathIndex` for path that do not need dropping in drop elaboration.

The 2 first commits are cleanups.

The next 2 commits displace `move` errors from move-path builder to borrowck. Move-path builder keeps the same logic, but does not carry error information any more.

The remaining commits allow to filter `MovePathIndex` creation according to types. This is used in drop elaboration, to avoid computing dataflow for paths that do not need dropping.
2023-10-24 00:25:32 +00:00
Camille GILLOT
8c1b039d48 Use a ConstValue instead. 2023-10-21 16:26:05 +00:00
Camille GILLOT
31d101093c Generate ValTrees in DataflowConstProp. 2023-10-21 16:20:46 +00:00
Camille GILLOT
c9c0c0cbca Do not create move paths that do not need dropping. 2023-10-21 10:32:59 +00:00
Camille GILLOT
a845bac6ba FileCheck annotations. 2023-10-21 07:08:53 +00:00
Camille GILLOT
8fb99afb02 Correct loop_headers logic. 2023-10-21 07:08:53 +00:00
Camille GILLOT
6abd8f119e Rebase fallout. 2023-10-21 07:08:48 +00:00
Camille GILLOT
df9e5ee038 Handle more terminators. 2023-10-21 07:01:24 +00:00
Camille GILLOT
0d0a536777 Do not thread through loop headers. 2023-10-21 06:59:37 +00:00
Camille GILLOT
751a079413 Implement JumpThreading pass. 2023-10-21 06:58:38 +00:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Camille GILLOT
328192bff4 FileCheck transmute. 2023-10-19 15:51:54 +00:00
Camille GILLOT
69d9369f0c FileCheck inline_shims. 2023-10-19 15:51:54 +00:00
Camille GILLOT
13683554ed FileCheck issue_106141. 2023-10-19 15:51:54 +00:00
Camille GILLOT
c679b208d2 Mention skip in README. 2023-10-19 15:51:54 +00:00
Camille GILLOT
d24e44a07e FileCheck lower_slice_len. 2023-10-19 15:51:54 +00:00
Camille GILLOT
ad057d4397 FileCheck lower_array_len. 2023-10-19 15:51:54 +00:00
Camille GILLOT
4bae847969 FileCheck lower_intrinsics. 2023-10-19 15:51:54 +00:00
Camille GILLOT
d8cffda66a FileCheck casts. 2023-10-19 15:51:54 +00:00