about summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2020-11-05Rust coverage before splitting instrument_coverage.rsRich Kadel-5/+7
2020-11-06inliner: Use substs_for_mir_bodyTomasz Miąsko-0/+91
Changes from 68965 extended the kind of instances that are being inlined. For some of those, the `instance_mir` returns a MIR body that is already expressed in terms of the types found in substitution array, and doesn't need further substitution. Use `substs_for_mir_body` to take that into account.
2020-11-03Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiserbors-346/+346
Properly handle lint spans after MIR inlining The first commit shows what happens when we apply mir inlining and then cause lints on the inlined MIR. The second commit fixes that. r? `@wesleywiser`
2020-10-27Show the inline stack of MIR lints that only occur after inliningOliver Scherer-346/+346
2020-10-27Disable "optimization to avoid load of address" in InstCombineJonas Schievink-3/+3
2020-10-26Auto merge of #77876 - tmiasko:simplify-locals, r=wesleywiserbors-8/+281
Remove unused set-discriminant statements and assignments regardless of rvalue * Represent use counts with u32 * Unify use count visitors * Change RemoveStatements visitor into a function * Remove unused set-discriminant statements * Use exhaustive match to clarify what is being optimized * Remove unused assignments regardless of rvalue kind
2020-10-26Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieubors-4/+4
Support custom allocators in `Box` r? `@Amanieu` This pull request requires a crater run. ### Prior work: - #71873 - #58457 - [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate Currently blocked on: - ~#77118~ - ~https://github.com/rust-lang/chalk/issues/615 (#77515)~
2020-10-26Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obkbors-165/+213
rustc_mir: track inlined callees in SourceScopeData. We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates. This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default. Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).` Fixes #76997. r? `@rust-lang/wg-mir-opt`
2020-10-26simplify-locals: Remove unused assignments regardless of rvalue kindTomasz Miąsko-34/+25
2020-10-26simplify-locals: Remove unused set-discriminant statementsTomasz Miąsko-20/+8
Update affected ui & incremental tests to use a user declared variable bindings instead of temporaries. The former are preserved because of debuginfo, the latter are not.
2020-10-26Rollup merge of #78247 - simonvandel:fix-78192, r=oli-obkDylan DPC-3/+41
Fix #78192 Check which places are marked dead. Fixes #78192
2020-10-26simplify-locals: Add yet to be optimized test casesTomasz Miąsko-0/+294
2020-10-25Merge remote-tracking branch 'upstream/master' into box-allocTim Diekmann-252/+498
2020-10-24Rollup merge of #78191 - tmiasko:temp-match-branch-simplification, r=oli-obkJonas Schievink-40/+287
Introduce a temporary for discriminant value in MatchBranchSimplification The optimization introduces additional uses of the discriminant operand, but does not ensure that it is still valid to evaluate it or that it still evaluates to the same value. Evaluate it once at original position, and store the result in a new temporary. Follow up on #78151. The optimization remains disabled by default. Closes #78239.
2020-10-22Check which places are deadSimon Vandel Sillesen-3/+41
Fixes #78192
2020-10-21rustc_mir: create the Integrator as soon as possible in MIR inlining.Eduard-Mihai Burtescu-52/+52
2020-10-21rustc_mir: don't throw away inlined locals' spans.Eduard-Mihai Burtescu-57/+57
2020-10-21rustc_mir: properly map scope parent chains into the caller when inlining.Eduard-Mihai Burtescu-19/+67
2020-10-21rustc_mir: track inlined callees in SourceScopeData.Eduard-Mihai Burtescu-53/+53
2020-10-21Introduce a temporary for discriminant value in MatchBranchSimplificationTomasz Miąsko-40/+287
The optimization introduces additional uses of the discriminant operand, but does not ensure that it is still valid to evaluate it or that it still evaluates to the same value. Evaluate it once at original position, and store the result in a new temporary.
2020-10-21Disable "optimization to avoid load of address" in InstCombineTomasz Miąsko-3/+3
2020-10-21Rollup merge of #78101 - RalfJung:foreign-static, r=oli-obkYuki Okushi-9/+9
fix static_ptr_ty for foreign statics Cc https://github.com/rust-lang/rust/issues/74840 This does not fix that issue but fixes a problem in `static_ptr_ty` that we noticed while discussing that issue. I also added and updated a few comments. The one about `internal` locals being ignored does not seem to have been true [even in the commit that introduced it](https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139). r? @oli-obk
2020-10-20Disable MatchBranchSimplificationTomasz Miąsko-150/+172
This optimization can result in unsoundness, because it introduces additional uses of a place holding the discriminant value without ensuring that it is valid to do so.
2020-10-19fix Rvalue::ty for ThreadLocalRefRalf Jung-9/+9
2020-10-19Update mir-opt test output for new assert macro implementation.Mara Bos-5/+5
2020-10-17Remove the old copy propagation passJonas Schievink-96/+73
2020-10-16Merge branch 'master' into box-allocTim Diekmann-2/+0
2020-10-14Create a single source scope for promotedsTomasz Miąsko-2/+0
A promoted inherits all scopes from the parent body. At the same time, almost all statements and terminators inside the promoted body so far refer only to one of those scopes: the outermost one. Instead of inheriting all scopes, inherit only a single scope corresponding to the location of the promoted, making sure that there are no references to other scopes.
2020-10-07Fix mir-opt output for 32 bitTim Diekmann-2/+2
2020-10-07Support custom allocators in `Box`Tim Diekmann-2/+2
Remove `Box::leak_with_alloc` Add leak-test for box with allocator Rename `AllocErr` to `AllocError` in leak-test Add `Box::alloc` and adjust examples to use the new API
2020-10-06Fix tests from rebaseMatthew Jasper-17/+17
2020-10-06Fix tests and bootstrapMatthew Jasper-17/+17
2020-10-05Updates to experimental coverage counter injectionRich Kadel-227/+18
This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len
2020-10-04Bless more test outputAaron Hill-11/+11
2020-10-04Bless mir-opt testsAaron Hill-1003/+827
2020-10-02Ignore now-broken mir-opt testJonas Schievink-1/+4
2020-10-01Disable the SimplifyArmIdentity mir-optWesley Wiser-150/+153
The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved.
2020-10-01Bless mir-opt tests for 32 bitAntoine Martin-16/+12
2020-10-01Add test for multiple terminator optimizationAntoine Martin-0/+44
2020-10-01Bless mir-opt tests with new optAntoine Martin-106/+52
2020-09-30Auto merge of #77069 - sexxi-goose:closure_print_2, r=nikomatsakisbors-2/+2
pretty.rs: Update Closure and Generator print More detailed outline: https://github.com/rust-lang/project-rfc-2229/pull/17 Closes: https://github.com/rust-lang/project-rfc-2229/issues/11 r? `@nikomatsakis` cc `@eddyb` `@davidtwco` `@estebank`
2020-09-29Auto merge of #76754 - varkor:diagnostic-cleanup-ii, r=ecstatic-morsebors-56/+56
Clean up diagnostics for arithmetic operation errors Plus a small tweak to a range pattern error message.
2020-09-28pretty.rs: Update Closure and Generator printAman Arora-2/+2
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-27Remove unnecessary -Zunsound-mir-opts uses in testsWesley Wiser-168/+177
2020-09-27[mir-opt] Introduce a new flag to enable experimental/unsound mir optsWesley Wiser-357/+391
2020-09-26Bless mir-opt 32-bit testsvarkor-21/+21
2020-09-26Bless mir-opt testsvarkor-35/+35
2020-09-25Fix testsmarmeladema-8/+8
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-74/+74
2020-09-25Rollup merge of #77066 - jonas-schievink:dest-prop-borrow, r=oli-obkJonas Schievink-178/+188
Fix dest prop miscompilation around references Closes https://github.com/rust-lang/rust/issues/77002