summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2022-08-02Avoid invalidating the CFG in MirPatch.Jakob Degen-172/+0
As a part of this change, we adjust MirPatch to not needlessly create unnecessary resume blocks.
2022-07-28bless mir opt testsNilstrieb-9912/+9912
2022-07-26Allow try_to_raw_bytes on u8 arrayMichael Goulet-0/+307
2022-07-12ignore wasm=32 & blessouz-a-130/+133
2022-07-12add new rval, pull deref earlyouz-a-76/+68
2022-07-09tweak names and output and blessRalf Jung-217/+219
2022-07-07Shorten span for closures.Camille GILLOT-81/+81
2022-07-06fix miri-opt testsTakayuki Maeda-10/+10
2022-07-05Auto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJungbors-0/+143
Change enum->int casts to not go through MIR casts. follow-up to https://github.com/rust-lang/rust/pull/96814 this simplifies all backends and even gives LLVM more information about the return value of `Rvalue::Discriminant`, enabling optimizations in more cases.
2022-07-04Auto merge of #98446 - nnethercote:derive-no-match-destructuring, r=scottmcmbors-66/+46
Don't use match-destructuring for derived ops on structs. r? `@scottmcm`
2022-07-04Don't use match-destructuring for derived ops on structs.Nicholas Nethercote-66/+46
All derive ops currently use match-destructuring to access fields. This is reasonable for enums, but sub-optimal for structs. E.g.: ``` fn eq(&self, other: &Point) -> bool { match *other { Self { x: ref __self_1_0, y: ref __self_1_1 } => match *self { Self { x: ref __self_0_0, y: ref __self_0_1 } => (*__self_0_0) == (*__self_1_0) && (*__self_0_1) == (*__self_1_1), }, } } ``` This commit changes derive ops on structs to use field access instead, e.g.: ``` fn eq(&self, other: &Point) -> bool { self.x == other.x && self.y == other.y } ``` This is faster to compile, results in smaller binaries, and is simpler to generate. Unfortunately, we have to keep the old pattern generating code around for `repr(packed)` structs because something like `&self.x` (which doesn't show up in `PartialEq` ops, but does show up in `Debug` and `Hash` ops) isn't allowed. But this commit at least changes those cases to use let-destructuring instead of match-destructuring, e.g.: ``` fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { { let Self(ref __self_0_0) = *self; { ::core::hash::Hash::hash(&(*__self_0_0), state) } } } ``` There are some unnecessary blocks remaining in the generated code, but I will fix them in a follow-up PR.
2022-07-02Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obkbors-11/+97
Enable MIR inlining Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.` #82280 has shown nice compile time wins could be obtained by enabling MIR inlining. Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed, except the interaction with polymorphization which is worked around specifically. I believe we can proceed with enabling MIR inlining in the near future (preferably just after beta branching, in case we discover new issues). Steps before merging: - [x] figure out the interaction with polymorphization; - [x] figure out how miri should deal with extern types; - [x] silence the extra arithmetic overflow warnings; - [x] remove the codegen fulfilment ICE; - [x] remove the type normalization ICEs while compiling nalgebra; - [ ] tweak the inlining threshold.
2022-07-01Ignore test with panic=abort.Camille GILLOT-12/+14
2022-07-01Shorten def_span for more items.Camille GILLOT-20/+20
2022-06-30Skip inlining if there are normalization issues.Camille GILLOT-0/+57
2022-06-30Check history earlier.Camille GILLOT-11/+38
2022-06-30Change enum->int casts to not go through MIR casts.Oli Scherer-0/+143
Instead we generate a discriminant rvalue and cast the result of that.
2022-06-28emit Retag for compound types with reference fieldsRalf Jung-0/+2
2022-06-21Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obkbors-42/+72
Remove dereferencing of Box from codegen Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains. Hopefully, this is the end of the Box<T, A> ICEs.
2022-06-20Auto merge of #97931 - xldenis:fix-if-let-source-scopes, r=nagisabors-165/+179
Fix `SourceScope` for `if let` bindings. Fixes #97799. I'm not sure how to test this properly, is there any way to observe the difference in behavior apart from `ui` tests? I'm worried that they would be overlooked in the case of a regression.
2022-06-15fix inline_into_box_place testDrMeepster-19/+23
2022-06-15remove box derefs from codgenDrMeepster-25/+51
2022-06-14Only create scopes for if letXavier Denis-846/+736
2022-06-14fix wrong evaluation in clippyb-naber-6/+6
2022-06-14address reviewb-naber-27/+27
2022-06-14manually bless 32-bit mir-opt testsb-naber-25/+25
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-47/+47
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-2/+2
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-10Actually fixXavier Denis-756/+872
2022-06-10Revert "More minimal changes"Xavier Denis-68/+76
This reverts commit fe0dedcb06947317d41a8570b7fff7f8690dcbff.
2022-06-10More minimal changesXavier Denis-76/+68
2022-06-10Fix `SourceScope` for `if let` bindings.Xavier Denis-85/+93
2022-06-07Preserve unused pointer to address castsTomasz Miąsko-0/+28
2022-06-03Fully stabilize NLLJack Huey-216/+214
2022-06-02add cast kind of from_exposed_addr (int-to-ptr casts)Ralf Jung-1/+1
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-4/+4
2022-05-31Auto merge of #97582 - tmiasko:pointer-address-cast, r=oli-obkbors-4/+4
Add a pointer to address cast kind A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-31Auto merge of #97570 - JakobDegen:dse-test, r=tmiaskobors-326/+21
Fix TLS access mir opt test and remove stale files Thanks `@pietroalbini` for noticing that the TLS test was not doing what it was supposed to. Switched to `PreCodegen` because `SimplifyCfg` does not run on opt level 0. Also addresses the easy part of #97564 . r? rust-lang/mir-opt
2022-05-31Add a pointer to address cast kindTomasz Miąsko-4/+4
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-30Fix TLS access mir opt test and remove stale filesJakob Degen-326/+21
2022-05-30validate derefer, run derefer inside generatorouz-a-3/+219
2022-05-24Fix/bless tests broken by DSEJakob Degen-289/+185
2022-05-24Add dead store elimination passJakob Degen-2/+167
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-74/+76
2022-05-21update mir dumpslcnr-38/+38
2022-05-18Add mir-opt test for asm_unwind + panic=abortLuqman Aden-0/+40
2022-05-13Rollup merge of #96989 - cjgillot:defpath-use, r=davidtwcoMatthias Krüger-18/+94
Be more precise than DefPathData::Misc. This variant was used for two unrelated things. Let's make this cleaner.
2022-05-12Bless mir-opt tests.Camille GILLOT-18/+94
2022-05-12Add mir-opt test.Camille GILLOT-0/+157
2022-05-09Use `FxIndexSet` to avoid sorting fake borrowsAaron Hill-4/+4
This fixes #96449, but I haven't yet been able to make the reproducer work using `#[cfg]` attributes, so we can't use the 'revision' infra to write a test The previous implementation relied on sorting by `PlaceRef`. This requires sorting by a `DefId`, which uses untracked state (see #93315)