Commit Graph

31 Commits

Author SHA1 Message Date
Tomasz Miąsko
a084e063e6 Fix validation and linting of injected MIR
Reevaluate `body.should_skip()` after updating the MIR phase to ensure
that injected MIR is processed correctly.

Update a few custom MIR tests that were ill-formed for the injected
phase.
2024-01-04 23:06:42 +01:00
Ralf Jung
0f9baa8a31 custom mir: make it clear what the return block is 2023-12-26 20:15:26 +01: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
Camille GILLOT
4ff03cd1a4 Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
Camille GILLOT
37f080edbc Also consider call and yield as MIR SSA. 2023-10-08 16:05:26 +00:00
Ralf Jung
7a6346660e custom_mir: change Call() terminator syntax to something more readable 2023-08-19 22:41:33 +02:00
Camille GILLOT
4de2d8fb66 Perform reference propagation earlier. 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
Gary Guo
19ce326a08 Bless tests 2023-06-23 18:36:25 +01:00
Ben Kimock
0a1fa411ed Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
Pietro Albini
4668123945
bless mir-opt
To reproduce the changes in this commit locally:

- Run `./x test tidy` and remove all the output files not associated
  with a test file anymore, as reported by tidy.
- Run `./x test tests/mir-opt --bless` to generate the new outputs.
2023-06-12 09:34:17 +02:00
Pietro Albini
070cc836e9
properly mark tests that require panic=abort 2023-06-12 09:34:15 +02:00
Camille GILLOT
f40f235879 Merge return place with other locals in CopyProp. 2023-05-14 12:06:34 +00:00
Camille GILLOT
6ad0497cc0 Use visit_assign to detect SSA locals. 2023-05-10 15:26:51 +00:00
Camille GILLOT
3c43b61b87 Do not consider borrowed Freeze locals as SSA. 2023-05-09 17:59:35 +00:00
Gary Guo
04126398c2 Ignore many tests on wasm32 2023-04-06 10:08:07 +01:00
Camille GILLOT
209eb8ae83 Do not grow assignment_order needlessly. 2023-02-27 20:02:18 +00:00
Camille GILLOT
2a32a2b64f Special case deref projections in SsaVisitor. 2023-02-27 20:02:18 +00:00
bors
639377ed73 Auto merge of #107449 - saethlin:enable-copyprop, r=oli-obk
Enable CopyProp

r? `@tmiasko`

`@rustbot` label +A-mir-opt
2023-02-16 03:44:37 +00:00
Ben Kimock
614df3fd5e Clearly document intentional UB in mir-opt tests
Co-authored-by: Jakob Degen <jakob.e.degen@gmail.com>
2023-02-13 13:50:50 -05:00
Ben Kimock
d8d18aae03 Fix UB in the test case 2023-02-12 14:42:16 -05:00
Ben Kimock
640ede7b0a Enable CopyProp by default, tune the impl a bit 2023-02-12 13:23:53 -05:00
Camille GILLOT
5c1cb5bbc6 Turn projections into copies in CopyProp. 2023-02-04 23:33:33 +00:00
Camille GILLOT
10ec94930b Bless tests. 2023-02-02 23:26:26 +00:00
Camille GILLOT
e8ac0404bd Remove assignment. 2023-01-31 18:07:57 +00:00
Camille GILLOT
3c10cf088a Remove both StorageLive and StorageDead in CopyProp. 2023-01-31 17:50:04 +00:00
Camille GILLOT
05ee406cc8 Add test. 2023-01-31 17:49:57 +00:00
Camille GILLOT
d29dc057ba Do not merge locals that have their address taken. 2023-01-27 18:22:45 +00:00
Camille GILLOT
8f1dbe54ea Discard raw pointers from SSA locals. 2023-01-27 18:22:45 +00:00
Camille GILLOT
d45815eb4a Only consider a local to be SSA if assignment dominates all uses. 2023-01-27 18:22:45 +00:00
Camille GILLOT
38b55dc684 Add tests. 2023-01-27 18:22:45 +00:00