summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2020-04-20Auto merge of #71232 - eddyb:print-const-adts, r=oli-obkbors-35/+35
ty/print: pretty-print constant aggregates (arrays, tuples and ADTs). Oddly enough, we don't have any UI tests showing this off in types, only `mir-opt` tests. However, the pretty form should show up in the test output diff of #71018, if this PR is merged first. <hr/> Examples of before/after: |`Option<bool>`| |:-:| |`{transmute(0x01): std::option::Option<bool>}`| | :sparkles: ↓↓↓ :sparkles: | |`std::option::Option::<bool>::Some(true)`| | `RawVec<u32>` | |:-:| | `ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>`| | :sparkles: ↓↓↓ :sparkles: | |`alloc::raw_vec::RawVec::<u32> { ptr: std::ptr::Unique::<u32> { pointer: {0x4 as *const u32}, _marker: std::marker::PhantomData::<u32> }, cap: 0usize, alloc: std::alloc::Global }`| <hr/> This PR is a prerequisite for #61486, *sort of*, in that we need to be able to pretty-print values in order to even consider how we might mangle them. We still don't have pretty-printing for constants of reference types, @oli-obk has the necessary support logic in a PR but I didn't want to interfere with that. <hr/> Each commit should be reviewed separately, as I've fixed a couple deficiencies along the way. r? @oli-obk cc @rust-lang/wg-mir-opt @varkor @yodaldevoid
2020-04-17Ignore generator-drop-cleanup on wasm32-bareJonas Schievink-31/+33
2020-04-17Adjust mir-opt test and make it drop somethingJonas Schievink-26/+54
2020-04-17ty/print: pretty-print constant aggregates (arrays, tuples and ADTs).Eduard-Mihai Burtescu-8/+8
2020-04-17mir: pretty-print `Rvalue::Aggregate` correctly.Eduard-Mihai Burtescu-27/+27
2020-04-15Remove other RvaluesWesley Wiser-133/+90
2020-04-15Add test caseWesley Wiser-0/+80
2020-04-14update 32 bit mir-opt testsBastian Kauschke-31/+119
2020-04-13bless mir opt testsBastian Kauschke-157/+730
2020-04-13Auto merge of #70989 - eddyb:mir-opt-32-pr-ci, r=Mark-Simulacrumbors-1/+77
ci: run mir-opt tests on PR CI also as 32-bit (for `EMIT_MIR_FOR_EACH_BIT_WIDTH`). Background: #69916 and [`src/test/mir-opt/README.md`](https://github.com/rust-lang/rust/blob/master/src/test/mir-opt/README.md): > By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the presence of pointers in constants or other bit width dependent things. In that case you can add > > ``` > // EMIT_MIR_FOR_EACH_BIT_WIDTH > ``` > > to your test, causing separate files to be generated for 32bit and 64bit systems. However, if you change the output of such a test (intentionally or not), or if you add a test and it varies between 32-bit and 64-bit platforms, you have to run this command (for a x64 linux host): `./x.py test --stage 1 --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu --bless src/test/mir-opt` Otherwise, bors trying to merge the PR will fail, since we test 32-bit targets there. But we don't on PR CI, which means there's no way the PR author would know (unless they were burnt by this already and know what to look for). This PR resolves that by running `mir-opt` tests for ~~`i686-unknown-linux-gnu`~~, on PR CI. **EDIT**: switched to `armv5te-unknown-linux-gnueabi` to work around LLVM 7 crashes (see https://github.com/rust-lang/compiler-builtins/pull/311#issuecomment-612270089), found during testing. cc @rust-lang/wg-mir-opt @rust-lang/infra
2020-04-11Use write!-style syntax for MIR assert terminatorrobojumper-24/+24
2020-04-11tests: don't use only-64bit in mir-opt tests.Eduard-Mihai Burtescu-1/+77
2020-04-08Add ignore-wasm32-bare to mir-opt tests that need it.Ana-Maria Mihalache-338/+340
2020-04-07Remove old mir-opt test format.Ana-Maria Mihalache-80/+2
2020-04-07Normalize away pairs of line:col numbers.Ana-Maria Mihalache-166/+166
2020-04-07Add EMIT_MIR_FOR_EACH_BIT_WIDTH to tests that need it.Ana-Maria Mihalache-488/+1855
2020-04-07--bless more mir-opt tests.Ana-Maria Mihalache-1013/+2254
2020-04-07--bless all mir-opt tests.Ana-Maria Mihalache-3046/+6572
2020-04-02Remove unused discriminant reads from MIR bodiesWesley Wiser-9/+56
Allow the `SimplifyLocals` pass to remove reads of discriminants if the read is never used.
2020-03-27Auto merge of #69916 - oli-obk:mir_bless, r=eddybbors-138/+795
Enable blessing of mir opt tests cc @rust-lang/wg-mir-opt cc @RalfJung Long overdue, but now you can finally just add a ```rust // EMIT_MIR rustc.function_name.MirPassName.before.mir ``` (or `after.mir` since most of the time you want to know the MIR after a pass). A `--bless` invocation will automatically create the files for you. I suggest we do this for all mir opt tests that have all of the MIR in their source anyway If you use `rustc.function.MirPass.diff` you only get the diff that the MIR pass causes on the MIR. Fixes #67865
2020-03-26Update tests to use llvm_asm!Amanieu d'Antras-11/+11
2020-03-26Enable `--bless`ing of MIR dumpsOliver Scherer-138/+795
2020-03-25Rollup merge of #70319 - lcnr:issue63695, r=eddybDylan DPC-1/+2
correctly normalize constants closes #70317 implements https://github.com/rust-lang/rust/issues/70125#issuecomment-602133708 r? eddyb cc @varkor
2020-03-25run test only on 64bitBastian Kauschke-0/+1
2020-03-24update mir opt testBastian Kauschke-1/+1
2020-03-24Rollup merge of #70259 - wesleywiser:use_reveal_all, r=eddybMazdak Farrokhzad-0/+64
Use Reveal::All in MIR optimizations Resolves some code review feedback in #67662. Fixes #68855 r? @eddyb
2020-03-23Rollup merge of #70080 - anyska:mir-double-space, r=oli-obkMazdak Farrokhzad-1/+1
rustc_mir: remove extra space when pretty-printing MIR.
2020-03-21Resolve worsened debug build codegenWesley Wiser-0/+64
2020-03-19Use erased regions in MIRMatthew Jasper-17/+24
2020-03-19Rollup merge of #69814 - jonas-schievink:gen-ret-unw, r=ZoxcMazdak Farrokhzad-0/+34
Smaller and more correct generator codegen This removes unnecessary panicking branches in the resume function when the generator can not return or unwind, respectively. Closes https://github.com/rust-lang/rust/issues/66100 It also addresses the correctness concerns wrt poisoning on unwind. These are not currently a soundness issue because any operation *inside* a generator that could possibly unwind will result in a cleanup path for dropping it, ultimately reaching a `Resume` terminator, which we already handled correctly. Future MIR optimizations might optimize that out, though. r? @Zoxc
2020-03-17rustc_mir: remove extra space when pretty-printing MIR.Ana-Maria Mihalache-1/+1
2020-03-17Update tests for erasing regions in typeckMatthew Jasper-22/+22
2020-03-16Auto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddybbors-18/+18
Deduplicate pretty printing of constants r? @eddyb for the pretty printing logic cc @RalfJung
2020-03-11Don't print all zsts as their type as it makes no sense for more complex ↵Oliver Scherer-3/+3
examples (e.g. structs)
2020-03-11Print leading zeros for non pointersOliver Scherer-1/+1
2020-03-11Don't print leading zeros on hex dumps constantsOliver Scherer-6/+6
2020-03-11Deduplicate and clean up pretty printing logicOliver Scherer-14/+14
2020-03-10Ignore `mir-opt` test when panic=abortDylan MacKenzie-0/+2
2020-03-10Add `mir-opt` test for better drop elaborationDylan MacKenzie-0/+41
2020-03-08Add test for unnecessary panic branchesJonas Schievink-0/+34
2020-02-16suspend -> yieldJonas Schievink-1/+1
2020-02-16Fix printing of `Yield` terminatorJonas Schievink-1/+1
2020-02-06Rollup merge of #68524 - jonas-schievink:generator-resume-arguments, r=ZoxcDylan DPC-30/+30
Generator Resume Arguments cc https://github.com/rust-lang/rust/issues/43122 and https://github.com/rust-lang/rust/issues/56974 Blockers: * [x] Fix miscompilation when resume argument is live across a yield point (https://github.com/rust-lang/rust/pull/68524#issuecomment-578459069) * [x] Fix 10% compile time regression in `await-call-tree` benchmarks (https://github.com/rust-lang/rust/pull/68524#issuecomment-578487162) * [x] Fix remaining 1-3% regression (https://github.com/rust-lang/rust/pull/68524#issuecomment-579566255) - resolved (https://github.com/rust-lang/rust/pull/68524#issuecomment-581144901) * [x] Make dropck rules account for resume arguments (https://github.com/rust-lang/rust/pull/68524#issuecomment-578541137) Follow-up work: * Change async/await desugaring to make use of this feature * Rewrite [`box_region.rs`](https://github.com/rust-lang/rust/blob/3d8778d767f0dde6fe2bc9459f21ead8e124d8cb/src/librustc_data_structures/box_region.rs) to use resume arguments (this shows up in profiles too)
2020-02-03Add more tests for or-patternsMatthew Jasper-0/+76
2020-02-03Fix miscompilationJonas Schievink-3/+2
2020-02-02No resume argument in the drop shimJonas Schievink-1/+0
2020-02-02Adjust mir-opt tests to new `yield` loweringJonas Schievink-29/+31
2020-02-01Update existing tests for or-patternsMatthew Jasper-190/+188
2020-01-24Render const pointers in MIR more compactlyOliver Scherer-4/+4
2020-01-20Rollup merge of #68335 - RalfJung:drop-in-place, r=Mark-SimulacrumDylan DPC-7/+7
Remove real_drop_in_place In https://github.com/rust-lang/rust/commit/af9b057156f610df3528a502c668cfed99ce8a1a, I added `real_drop_in_place` because Stacked Borrows at the time couldn't handle transmuting of mutable references to raw pointers and back. Stacked Borrows 2, however, doesn't have any issue with these transmutes, so it is time to remove this hack again.