Commit graph

164 commits

Author SHA1 Message Date
Jakob Degen
9fb8da8f8f Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
Ralf Jung
9397ea1368 make retagging work even with 'unstable' places 2022-12-06 10:33:34 +01:00
Jakob Degen
f4f777772e Disable top-down inlining 2022-12-01 18:32:45 -08:00
Jakob Degen
245c60749a Rewrite dest prop.
This fixes a number of correctness issues from the previous version. Additionally, we use a new
strategy which has much better performance charactersitics and also finds more opportunities to
apply the optimization.
2022-11-26 18:04:54 -08:00
Lokathor
ea47943212 Refine instruction_set inline rules
Previously an exact match of the `instruction_set` attribute was required for an MIR inline to be considered. This change checks for an exact match *only* if the callee sets an `instruction_set` in the first place. When the callee does not declare an instruction set then it is considered to be platform agnostic code and it's allowed to be inline'd into the caller.
2022-11-25 15:19:16 -07:00
Jakob Degen
0bd4f76944 Ban dashes in miropt test file names 2022-11-02 15:54:46 -07:00
Matthias Krüger
2f2664923b
Rollup merge of #102778 - nbdd0121:mir, r=tmiasko
Fix MIR inlining of asm_unwind

The MIR inlining currently doesn't handle inline asm's unwind edge correctly.

This code will cause ICE:
```rust
struct D;

impl Drop for D {
    fn drop(&mut self) {}
}

#[inline(always)]
fn foo() {
    let _d = D;
    unsafe { std::arch::asm!("", options(may_unwind)) };
}

pub fn main() {
    foo();
}
```

This PR fixes this issue. I also take the opportunity to extract common code into a method.
2022-10-08 14:38:19 +02:00
Gary Guo
fc83427066 Fix test 2022-10-07 18:23:12 +01:00
Gary Guo
242348343b Fix MIR inlining of asm_unwind 2022-10-07 12:59:38 +01:00
ouz-a
d59c7ff000 Remove mir::CastKind::Misc 2022-10-06 15:32:41 +03:00
b-naber
6118ee343f address review 2022-09-26 14:21:39 +02:00
bors
c524c7dd25 Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr
Use only ty::Unevaluated<'tcx, ()> in type system

r? `@lcnr`
2022-09-17 03:04:22 +00:00
b-naber
6af8fb7936 address review again 2022-09-14 17:30:25 +02:00
Camille GILLOT
1f370d9437 Use tcx.hir() utils for spans in MIR building.
This corrects the `span_with_body` in the case of closures, which was
incorrectly shortened to the `def_span`.
2022-09-13 19:18:23 +02:00
b-naber
29c0364c37 rebase 2022-09-13 17:48:05 +02:00
b-naber
db9a2d2fbe bless tests 2022-09-13 17:47:33 +02:00
Jakob Degen
46130a1d18 Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH 2022-09-04 23:25:25 -07:00
Ben Kimock
cd1a42a95d Use the declaration's SourceInfo for FnEntry retags, not the outermost 2022-08-28 11:40:10 -04:00
Tomasz Miąsko
f8ca6aad83 ./x.py test --bless 2022-08-23 00:00:00 +00:00
Nilstrieb
5d7ce21b6b bless mir-opt tests 2022-08-22 15:19:40 +02:00
Camille GILLOT
86645c9cf7 Ignore substs when checking inlining history. 2022-08-17 19:25:09 +02:00
Tomasz Miąsko
7d2131a204 ./x.py test --bless 2022-08-06 11:16:23 +02:00
Jakob Degen
efa5eaa5d1 Avoid invalidating the CFG in MirPatch.
As a part of this change, we adjust MirPatch to not needlessly create unnecessary resume blocks.
2022-08-02 18:57:54 -07:00
Nilstrieb
11c0280798 bless mir opt tests 2022-07-28 14:24:44 +02:00
ouz-a
cb0017f2f8 add new rval, pull deref early 2022-07-12 14:26:41 +03:00
Ralf Jung
4e7aaf1f44 tweak names and output and bless 2022-07-09 07:43:56 -04:00
Camille GILLOT
8cc87250ef Shorten span for closures. 2022-07-07 09:27:42 +02:00
Camille GILLOT
2f35392383 Ignore test with panic=abort. 2022-07-01 17:45:13 +02:00
Camille GILLOT
ce4b5c8afc Skip inlining if there are normalization issues. 2022-06-30 21:45:29 +02:00
Camille GILLOT
114c9284b9 Check history earlier. 2022-06-30 21:45:29 +02:00
DrMeepster
954fbe35e1 fix inline_into_box_place test 2022-06-15 18:39:19 -07:00
DrMeepster
cb417881a9 remove box derefs from codgen 2022-06-15 18:38:26 -07:00
b-naber
90c4b947aa fix wrong evaluation in clippy 2022-06-14 16:11:35 +02:00
b-naber
773d8b2e15 address review 2022-06-14 16:11:27 +02:00
b-naber
17323e05ce manually bless 32-bit mir-opt tests 2022-06-14 16:09:06 +02:00
b-naber
705d818bd5 implement valtrees as the type-system representation for constant values 2022-06-14 16:07:11 +02:00
ouz-a
e71913e847 validate derefer, run derefer inside generator 2022-05-30 18:36:14 +03:00
Jakob Degen
09b0936db2 Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
Matthias Krüger
f2100daf32
Rollup merge of #96989 - cjgillot:defpath-use, r=davidtwco
Be more precise than DefPathData::Misc.

This variant was used for two unrelated things. Let's make this cleaner.
2022-05-13 05:33:13 +02:00
Camille GILLOT
b7f0509588 Bless mir-opt tests. 2022-05-12 21:37:57 +02:00
Camille GILLOT
bd41874eea Add mir-opt test. 2022-05-12 12:46:28 +02:00
Ralf Jung
d455752970 bless mir-opt 2022-05-06 10:58:54 +02:00
Oli Scherer
db02e61038 Generate an intermediate temporary for Drop constants.
To limit the fallout from this, don't do this for the last (or only) operand in an rvalue.
2022-05-04 09:09:52 +00:00
bors
055bf4ccd5 Auto merge of #96116 - ouz-a:mir-opt, r=oli-obk
Make derefer work everwhere

Follow up work on previous PR's #95649 and #95857.

r? rust-lang/mir-opt

_Co-Authored-By: `@oli-obk_`
2022-04-25 19:34:52 +00:00
Dylan DPC
38e3f523c0
Rollup merge of #93313 - tmiasko:uninhabited, r=tmandry
Check if call return type is visibly uninhabited when building MIR

The main motivation behind the change is to expose information about diverging
calls to the generator transform and match the precision of drop range tracking
which already understands that call expressions with visibly uninhabited types
diverges.

This change should also accept strictly more programs than before. That is
programs that were previously rejected due to errors raised by control-flow
sensitive checks in a code that is no longer considered reachable.

Fixes #93161.
2022-04-20 18:26:01 +02:00
ouz-a
8ba8b223af fix CI err 2022-04-16 16:35:03 +03:00
ouz-a
aada74b28f Make derefer work everwhere
Co-Authored-By: Oli Scherer <332036+oli-obk@users.noreply.github.com>
2022-04-16 16:03:14 +03:00
Eduardo Sánchez Muñoz
176a618242 Update inline-into-box-place test output 2022-04-14 19:35:44 +02:00
Jakob Degen
2a040284a5 Fix tests broken by deaggregation change 2022-04-11 09:26:26 -04:00
ouz-a
1cf6d6940c kill temp early 2022-04-05 22:38:03 +03:00