New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't rerun MIR passes when inlining #55244

Merged
merged 4 commits into from Oct 28, 2018

Conversation

Projects
None yet
6 participants
@wesleywiser
Member

wesleywiser commented Oct 21, 2018

Fixes #50411

r? @nikomatsakis

I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate compile-flags directive to the test.

Thanks for you help on this!

cc @RalfJung related to your PR #55086

@wesleywiser wesleywiser changed the title from Issue 50411 to Don't rerun MIR passes when inlining Oct 21, 2018

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Oct 21, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:48:17] .................................................................................................... 2300/4660
[00:48:20] .................................................................................................... 2400/4660
[00:48:24] .................................................................................................... 2500/4660
[00:48:29] .................................................................................................... 2600/4660
[00:48:32] .........................................F.......................................................... 2700/4660
[00:48:39] .................................................................................................... 2900/4660
[00:48:42] ...................................................................................i................ 3000/4660
[00:48:45] .................................................................................................... 3100/4660
[00:48:49] ..........................................i.i..ii................................................... 3200/4660
---
[00:49:37] 
[00:49:37] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:49:37] 
[00:49:37] 
[00:49:37] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "bootstrap-32pr67l4sa8g0
134744 ./obj/build/bootstrap/debug/incremental/bootstrap-32pr67l4sa8g0/s-f5xk26o26r-m8df0s-25uz5wr4on2bc
129336 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu
129332 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release
122288 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps
113444 ./obj/build/x86_64-unknown-linux-gnu/stage1-std
---
travis_time:end:2aeee180:start=1540137373383862253,finish=1540137373389744025,duration=5881772
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:281b3ec0
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!check

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@@ -155,17 +155,30 @@ pub trait MirPass {
mir: &mut Mir<'tcx>);
}
pub macro run_passes($tcx:ident, $mir:ident, $def_id:ident, $suite_index:expr; $($pass:expr,)*) {{
let suite_index: usize = $suite_index;
pub macro run_passes(

This comment has been minimized.

@nikomatsakis

nikomatsakis Oct 22, 2018

Contributor

Unrelated: it'd be nice to move this out of a macro and into some kind of generic function. I don't really see any inherent difficulty in that. The functon could take a vec![&dyn MirPass] or else we could do some hancy h-list sort of thing (hint: seems unnecessary =)

Show resolved Hide resolved src/librustc/mir/mod.rs

nikomatsakis and others added some commits Oct 20, 2018

Don't rerun Mir passes when inlining
When inlining a function using the Mir inliner, we shouldn't rerun the
various Mir passes on it because the Mir has already been lowered and
that wil break various early Mir passes.

The issue in #50411 is that we've inlined a function with promotions
whose Mir has already been lowered. The promotions are then copied into
the local function and we begin to run passes on their lowered Mir
which causes the ICE.

Fixes #50411
Remove the `suite_index` parameter of the `run_passes!()` macro
This can be obtained via the `$mir_phase` value.
Replace the `run_passes!` macro with a regular function
As suggested in the feedback for #55244.

When I replaced the macro with a function, rustc started complaining
that there were two unused functions so I also removed those.
@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 23, 2018

Good ideas! I've implemented the feedback.

@nikomatsakis

r=me

mir: &mut Mir<'tcx>,
def_id: DefId,
mir_phase: MirPhase,
passes: &[&dyn MirPass]) {

This comment has been minimized.

@nikomatsakis

nikomatsakis Oct 23, 2018

Contributor

Nit: rustfmt would put the ) { on the next line (with a trailing comma here)

This comment has been minimized.

@wesleywiser

wesleywiser Oct 23, 2018

Member

Ah I was unsure of the convention here.

@nikomatsakis

This comment has been minimized.

Contributor

nikomatsakis commented Oct 23, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Oct 23, 2018

📌 Commit c535147 has been approved by nikomatsakis

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 23, 2018

Is it worth getting a perf run on these changes? I'm unsure of what the impact might be. It's probably small though...

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 23, 2018

@bors try

For perf run, if we want that

@bors

This comment has been minimized.

Contributor

bors commented Oct 23, 2018

🙅 Please do not try after a pull request has been r+ed. If you need to try, unapprove (r-) it first.

@nikomatsakis

This comment has been minimized.

Contributor

nikomatsakis commented Oct 24, 2018

@wesleywiser it is not worth it, in my opinion =)

/// Gets the index of the current MirPhase within the set of all MirPhases.
pub fn phase_index(&self) -> usize {
match self {
MirPhase::Build => 0,

This comment has been minimized.

@bjorn3

bjorn3 Oct 25, 2018

Contributor

Could you use self as usize instead of matching?

This comment has been minimized.

@RalfJung

RalfJung Oct 25, 2018

Member

But then please assign the discriminants explicitly.

This comment has been minimized.

@wesleywiser

wesleywiser Oct 25, 2018

Member

Sure, I can change that.

@nikomatsakis

This comment has been minimized.

Contributor

nikomatsakis commented Oct 25, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

📌 Commit 4655866 has been approved by nikomatsakis

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 25, 2018

Rollup merge of rust-lang#55244 - wesleywiser:issue-50411, r=nikomats…
…akis

Don't rerun MIR passes when inlining

Fixes rust-lang#50411

r? @nikomatsakis

I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate `compile-flags` directive to the test.

Thanks for you help on this!

cc @RalfJung related to your PR rust-lang#55086

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55357 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #54490 (Rewrite the `UnconditionalRecursion` lint to use MIR)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #55010 (Add template parameter debuginfo to generic types)
 - #55150 (Do not allow moving out of thread local under ast borrowck)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55221 (Don't emit cannot move errors twice in migrate mode)
 - #55238 (Remove the `alloc_jemalloc` crate)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55257 (Allow extern statics with an extern type)
 - #55269 (fix typos in various places)
 - #55301 (List allowed tokens after macro fragments)
 - #55325 (Fix link to macros chapter)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55357 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #54490 (Rewrite the `UnconditionalRecursion` lint to use MIR)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #55010 (Add template parameter debuginfo to generic types)
 - #55150 (Do not allow moving out of thread local under ast borrowck)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55221 (Don't emit cannot move errors twice in migrate mode)
 - #55238 (Remove the `alloc_jemalloc` crate)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55257 (Allow extern statics with an extern type)
 - #55269 (fix typos in various places)
 - #55301 (List allowed tokens after macro fragments)
 - #55325 (Fix link to macros chapter)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55357 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #54490 (Rewrite the `UnconditionalRecursion` lint to use MIR)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #55010 (Add template parameter debuginfo to generic types)
 - #55150 (Do not allow moving out of thread local under ast borrowck)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55221 (Don't emit cannot move errors twice in migrate mode)
 - #55238 (Remove the `alloc_jemalloc` crate)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55257 (Allow extern statics with an extern type)
 - #55269 (fix typos in various places)
 - #55301 (List allowed tokens after macro fragments)
 - #55325 (Fix link to macros chapter)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Oct 28, 2018

Rollup merge of rust-lang#55244 - wesleywiser:issue-50411, r=nikomats…
…akis

Don't rerun MIR passes when inlining

Fixes rust-lang#50411

r? @nikomatsakis

I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate `compile-flags` directive to the test.

Thanks for you help on this!

cc @RalfJung related to your PR rust-lang#55086

bors added a commit that referenced this pull request Oct 28, 2018

Auto merge of #55433 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #55148 (Implement FromStr for PathBuf)
 - #55191 (Fix sub-variant doc display)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55252 (Add MaybeUninit::new)
 - #55304 (ci: Move global credentials to web configuration)
 - #55389 (Remove unnecessary mut in iterator.find_map documentation example, R…)
 - #55406 (Update string.rs)
 - #55412 (Fix an ICE in the min_const_fn analysis)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Oct 28, 2018

Auto merge of #55433 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #55148 (Implement FromStr for PathBuf)
 - #55185 (path suggestions in Rust 2018 should point out the change in semantics)
 - #55191 (Fix sub-variant doc display)
 - #55199 (Impl items have generics)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55252 (Add MaybeUninit::new)
 - #55257 (Allow extern statics with an extern type)
 - #55389 (Remove unnecessary mut in iterator.find_map documentation example, R…)
 - #55406 (Update string.rs)
 - #55412 (Fix an ICE in the min_const_fn analysis)
 - #55421 (Add ManuallyDrop::take)

@bors bors merged commit 4655866 into rust-lang:master Oct 28, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment