Skip to content
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

Use a more efficient iteration order for backward dataflow #62063

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

ecstatic-morse
Copy link
Contributor

This applies the same basic principle as #62062 to the reverse dataflow analysis used to compute liveness information. It is functionally equivalent, except that post-order is used instead of reverse post-order.

In the long-term, BitDenotation should probably be extended to support both forward and backward dataflow, but there's some more work needed to get to that point.

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 22, 2019
@ecstatic-morse
Copy link
Contributor Author

r? @pnkfelix

@rust-highfive rust-highfive assigned pnkfelix and unassigned varkor Jun 22, 2019
@ecstatic-morse ecstatic-morse changed the title Use more efficient iteration order for backward dataflow Use a more efficient iteration order for backward dataflow Jun 22, 2019
@nagisa
Copy link
Member

nagisa commented Jun 22, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jun 22, 2019

⌛ Trying commit 8e31907037a8e96b0b0699402d6251e6629504e1 with merge 64420abf98e4822f5299cc07aabf03f9ca5465d0...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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.
travis_time:end:1a54d7b9:start=1561235720805642006,finish=1561235721533614591,duration=727972585
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:57:52] .................................................................................................... 500/2922
[00:58:03] .................................................................................................... 600/2922
[00:58:18] .................................................................................................... 700/2922
[00:58:29] .................................................................................................... 800/2922
[00:58:37] .............................................F...............F..F................................... 900/2922
[00:59:02] .................................................................................................... 1100/2922
[00:59:11] .................................................................................................... 1200/2922
[00:59:21] .................................................................................................... 1300/2922
[00:59:33] ......................ii............................................................................ 1400/2922
---
[01:03:17] failures:
[01:03:17] 
[01:03:17] ---- [run-pass] run-pass/generator/drop-env.rs stdout ----
[01:03:17] 
[01:03:17] error: test compilation failed although it shouldn't!
[01:03:17] status: exit code: 101
[01:03:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/generator/drop-env.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/generator/drop-env/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/generator/drop-env/auxiliary"
[01:03:17] ------------------------------------------
[01:03:17] 
[01:03:17] ------------------------------------------
[01:03:17] stderr:
[01:03:17] stderr:
[01:03:17] ------------------------------------------
[01:03:17] thread 'rustc' panicked at 'Unreachable basic blocks during dataflow analysis', src/librustc_mir/util/liveness.rs:92:5
[01:03:17] 
[01:03:17] error: internal compiler error: unexpected panic
[01:03:17] 
[01:03:17] note: the compiler unexpectedly panicked. this is a bug.
[01:03:17] note: the compiler unexpectedly panicked. this is a bug.
[01:03:17] 
[01:03:17] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:03:17] 
[01:03:17] note: rustc 1.37.0-dev running on x86_64-unknown-linux-gnu
[01:03:17] 
[01:03:17] note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
[01:03:17] 
[01:03:17] ------------------------------------------
[01:03:17] 
[01:03:17] 
[01:03:17] 
[01:03:17] ---- [run-pass] run-pass/generator/smoke.rs stdout ----
[01:03:17] 
[01:03:17] error: test compilation failed although it shouldn't!
[01:03:17] status: exit code: 101
[01:03:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/generator/smoke.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/generator/smoke/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--test" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/generator/smoke/auxiliary"
[01:03:17] ------------------------------------------
[01:03:17] 
[01:03:17] ------------------------------------------
[01:03:17] stderr:
[01:03:17] stderr:
[01:03:17] ------------------------------------------
[01:03:17] thread 'rustc' panicked at 'Unreachable basic blocks during dataflow analysis', src/librustc_mir/util/liveness.rs:92:5
[01:03:17] 
[01:03:17] error: internal compiler error: unexpected panic
[01:03:17] 
[01:03:17] note: the compiler unexpectedly panicked. this is a bug.
[01:03:17] note: the compiler unexpectedly panicked. this is a bug.
[01:03:17] 
[01:03:17] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:03:17] 
[01:03:17] note: rustc 1.37.0-dev running on x86_64-unknown-linux-gnu
[01:03:17] 
[01:03:17] note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0
[01:03:17] 
[01:03:17] ------------------------------------------
[01:03:17] 
[01:03:17] 
[01:03:17] 
[01:03:17] ---- [run-pass] run-pass/generator/xcrate.rs stdout ----
[01:03:17] 
[01:03:17] error: auxiliary build of "/checkout/src/test/run-pass/generator/auxiliary/xcrate.rs" failed to compile: 
[01:03:17] status: exit code: 101
[01:03:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/generator/auxiliary/xcrate.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/generator/xcrate/auxiliary" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "dylib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/generator/xcrate/auxiliary"
[01:03:17] ------------------------------------------
[01:03:17] 
[01:03:17] ------------------------------------------
[01:03:17] stderr:
[01:03:17] stderr:
[01:03:17] ------------------------------------------
[01:03:17] warning: trait objects without an explicit `dyn` are deprecated
[01:03:17]   --> /checkout/src/test/run-pass/generator/auxiliary/xcrate.rs:14:37
[01:03:17]    |
[01:03:17] LL | pub fn bar<T: 'static>(t: T) -> Box<Generator<Yield = T, Return = ()> + Unpin> {
[01:03:17]    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Generator<Yield = T, Return = ()> + Unpin`
[01:03:17]    = note: #[warn(bare_trait_objects)] on by default
[01:03:17] 
[01:03:17] 
[01:03:17] thread 'rustc' panicked at 'Unreachable basic blocks during dataflow analysis', src/librustc_mir/util/liveness.rs:92:5
[01:03:17] 
[01:03:17] error: internal compiler error: unexpected panic
[01:03:17] 
[01:03:17] note: the compiler unexpectedly panicked. this is a bug.
[01:03:17] note: the compiler unexpectedly panicked. this is a bug.
[01:03:17] 
[01:03:17] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:03:17] 
[01:03:17] note: rustc 1.37.0-dev running on x86_64-unknown-linux-gnu
[01:03:17] 
[01:03:17] note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0 --crate-type dylib
[01:03:17] 
[01:03:17] ------------------------------------------
[01:03:17] 
[01:03:17] 
---
[01:03:17] test result: FAILED. 2910 passed; 3 failed; 9 ignored; 0 measured; 0 filtered out
[01:03:17] 
[01:03:17] 
[01:03:17] 
[01:03:17] 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/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:03:17] 
[01:03:17] 
[01:03:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:03:17] Build completed unsuccessfully in 0:58:24
---
travis_time:end:2991ce3c:start=1561239531235601865,finish=1561239531240426254,duration=4824389
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1f3dced4
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!chec

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)

@nagisa
Copy link
Member

nagisa commented Jun 22, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jun 22, 2019

⌛ Trying commit a6eb19f1bd3992e04b8ae2bb55360b522b6935e4 with merge 062f8b868d47236fa65183c8fedd5de70cbc8eb9...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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.
travis_time:end:041e2d6e:start=1561240909618576078,finish=1561240998406062147,duration=88787486069
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:07:08]    Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:08:20]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:14:17]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:14:17]    Compiling rustc_allocator v0.0.0 (/checkout/src/librustc_allocator)
[00:14:28] error[E0599]: no method named `len` found for type `rustc_data_structures::work_queue::WorkQueue<rustc::mir::BasicBlock>` in the current scope
[00:14:28]    |
[00:14:28]    |
[00:14:28] 98 |     debug_assert!(dirty_queue.len() == body.basic_blocks().len(),
[00:14:28] 
[00:14:31] error: aborting due to previous error
[00:14:31] 
[00:14:31] For more information about this error, try `rustc --explain E0599`.
---
travis_time:end:0762d8d6:start=1561241965208996959,finish=1561241965214962401,duration=5965442
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:2cb593ac
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1f856e60
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/li

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)

@bors
Copy link
Contributor

bors commented Jun 22, 2019

💔 Test failed - checks-travis

@rust-highfive
Copy link
Collaborator

The job dist-x86_64-linux 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.
travis_fold:end:services

travis_fold:start:git.checkout
travis_time:start:09aa16d8
$ git clone --depth=2 --branch=try https://github.com/rust-lang/rust.git rust-lang/rust
---
[00:19:04]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:23:59]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:23:59]    Compiling rustc_allocator v0.0.0 (/checkout/src/librustc_allocator)
[00:23:59]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:24:11] error[E0599]: no method named `len` found for type `rustc_data_structures::work_queue::WorkQueue<rustc::mir::BasicBlock>` in the current scope
[00:24:11]    |
[00:24:11]    |
[00:24:11] 98 |     debug_assert!(dirty_queue.len() == body.basic_blocks().len(),
[00:24:11] 
[00:24:15] error: aborting due to previous error
[00:24:15] 
[00:24:15] For more information about this error, try `rustc --explain E0599`.
---
travis_time:end:1e38342a:start=1561243411948741422,finish=1561243411955191662,duration=6450240
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0aeb5ab3
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$COREtravis_time:start:16a82d86
travis_time:end:16a82d86:start=1561243411990408017,finish=1561243412004394914,duration=13986897
travis_fold:end:after_failure.6

Done. Your build exited with 1.

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)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2019
@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Jun 23, 2019

I'm sorry, I forgot to remove the debug assertion from this one. Can someone trigger another build?

@Centril
Copy link
Contributor

Centril commented Jun 23, 2019

@bors try

@bors
Copy link
Contributor

bors commented Jun 23, 2019

⌛ Trying commit 4773e5519b989edf4639929feae343ccb43d62e0 with merge 56b7200c037e2a958f7d907e778b87e58beb7079...

@bors
Copy link
Contributor

bors commented Jun 23, 2019

☀️ Try build successful - checks-travis
Build commit: 56b7200c037e2a958f7d907e778b87e58beb7079

@Centril
Copy link
Contributor

Centril commented Jun 23, 2019

@rust-timer build 56b7200c037e2a958f7d907e778b87e58beb7079

@rust-timer
Copy link
Collaborator

Success: Queued 56b7200c037e2a958f7d907e778b87e58beb7079 with parent a96ba96, comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 56b7200c037e2a958f7d907e778b87e58beb7079, comparison URL.

@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Jun 27, 2019

This does substantially reduce the number of iterations, it's just that backward dataflow is only used for generators at the moment (I should have checked this before I requested a perf run, although #62062 needed one anyway). Here are the results from running the tests in src/ui/run-pass/generators before and after this change, with overhead being (number of iterations - number of basic blocks) / number of basic blocks:

Before:

DEBUG 2019-06-27T00:38:26Z: rustc_mir::util::liveness: Liveness dataflow converged after 17 iterations (30.76923076923077% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 37 iterations (85% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 37 iterations (85% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (16.666666666666664% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 24 iterations (60% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 13 iterations (44.44444444444444% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 13 iterations (44.44444444444444% overhead)
DEBUG 2019-06-27T00:38:27Z: rustc_mir::util::liveness: Liveness dataflow converged after 23 iterations (53.333333333333336% overhead)
DEBUG 2019-06-27T00:38:28Z: rustc_mir::util::liveness: Liveness dataflow converged after 96 iterations (50% overhead)
DEBUG 2019-06-27T00:38:29Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (14.285714285714285% overhead)
DEBUG 2019-06-27T00:38:29Z: rustc_mir::util::liveness: Liveness dataflow converged after 4 iterations (0% overhead)
DEBUG 2019-06-27T00:38:29Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (14.285714285714285% overhead)
DEBUG 2019-06-27T00:38:30Z: rustc_mir::util::liveness: Liveness dataflow converged after 13 iterations (30% overhead)
DEBUG 2019-06-27T00:38:30Z: rustc_mir::util::liveness: Liveness dataflow converged after 32 iterations (45.45454545454545% overhead)
DEBUG 2019-06-27T00:38:30Z: rustc_mir::util::liveness: Liveness dataflow converged after 10 iterations (25% overhead)
DEBUG 2019-06-27T00:38:30Z: rustc_mir::util::liveness: Liveness dataflow converged after 18 iterations (20% overhead)
DEBUG 2019-06-27T00:38:31Z: rustc_mir::util::liveness: Liveness dataflow converged after 15 iterations (50% overhead)
DEBUG 2019-06-27T00:38:31Z: rustc_mir::util::liveness: Liveness dataflow converged after 9 iterations (28.57142857142857% overhead)
DEBUG 2019-06-27T00:38:31Z: rustc_mir::util::liveness: Liveness dataflow converged after 30 iterations (36.36363636363637% overhead)
DEBUG 2019-06-27T00:38:32Z: rustc_mir::util::liveness: Liveness dataflow converged after 24 iterations (60% overhead)
DEBUG 2019-06-27T00:38:32Z: rustc_mir::util::liveness: Liveness dataflow converged after 24 iterations (60% overhead)
DEBUG 2019-06-27T00:38:32Z: rustc_mir::util::liveness: Liveness dataflow converged after 10 iterations (25% overhead)
DEBUG 2019-06-27T00:38:32Z: rustc_mir::util::liveness: Liveness dataflow converged after 37 iterations (60.86956521739131% overhead)
DEBUG 2019-06-27T00:38:33Z: rustc_mir::util::liveness: Liveness dataflow converged after 24 iterations (33.33333333333333% overhead)
DEBUG 2019-06-27T00:38:33Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (16.666666666666664% overhead)
DEBUG 2019-06-27T00:38:33Z: rustc_mir::util::liveness: Liveness dataflow converged after 10 iterations (25% overhead)
DEBUG 2019-06-27T00:38:34Z: rustc_mir::util::liveness: Liveness dataflow converged after 52 iterations (36.84210526315789% overhead)
DEBUG 2019-06-27T00:38:34Z: rustc_mir::util::liveness: Liveness dataflow converged after 25 iterations (92.3076923076923% overhead)
DEBUG 2019-06-27T00:38:34Z: rustc_mir::util::liveness: Liveness dataflow converged after 19 iterations (35.714285714285715% overhead)
DEBUG 2019-06-27T00:38:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 12 iterations (33.33333333333333% overhead)
DEBUG 2019-06-27T00:38:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (16.666666666666664% overhead)
DEBUG 2019-06-27T00:38:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (16.666666666666664% overhead)
DEBUG 2019-06-27T00:38:36Z: rustc_mir::util::liveness: Liveness dataflow converged after 10 iterations (25% overhead)
DEBUG 2019-06-27T00:38:37Z: rustc_mir::util::liveness: Liveness dataflow converged after 24 iterations (41.17647058823529% overhead)
DEBUG 2019-06-27T00:38:37Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (16.666666666666664% overhead)
DEBUG 2019-06-27T00:38:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 21 iterations (50% overhead)
DEBUG 2019-06-27T00:38:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (40% overhead)

After:

DEBUG 2019-06-27T00:42:34Z: rustc_mir::util::liveness: Liveness dataflow converged after 13 iterations (0% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 20 iterations (0% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 20 iterations (0% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 6 iterations (0% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 19 iterations (26.666666666666668% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 9 iterations (0% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 9 iterations (0% overhead)
DEBUG 2019-06-27T00:42:35Z: rustc_mir::util::liveness: Liveness dataflow converged after 15 iterations (0% overhead)
DEBUG 2019-06-27T00:42:36Z: rustc_mir::util::liveness: Liveness dataflow converged after 64 iterations (0% overhead)
DEBUG 2019-06-27T00:42:37Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (0% overhead)
DEBUG 2019-06-27T00:42:37Z: rustc_mir::util::liveness: Liveness dataflow converged after 4 iterations (0% overhead)
DEBUG 2019-06-27T00:42:37Z: rustc_mir::util::liveness: Liveness dataflow converged after 7 iterations (0% overhead)
DEBUG 2019-06-27T00:42:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 10 iterations (0% overhead)
DEBUG 2019-06-27T00:42:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 22 iterations (0% overhead)
DEBUG 2019-06-27T00:42:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (0% overhead)
DEBUG 2019-06-27T00:42:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 15 iterations (0% overhead)
DEBUG 2019-06-27T00:42:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 11 iterations (10% overhead)
DEBUG 2019-06-27T00:42:38Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (14.285714285714285% overhead)
DEBUG 2019-06-27T00:42:39Z: rustc_mir::util::liveness: Liveness dataflow converged after 23 iterations (4.545454545454546% overhead)
DEBUG 2019-06-27T00:42:39Z: rustc_mir::util::liveness: Liveness dataflow converged after 19 iterations (26.666666666666668% overhead)
DEBUG 2019-06-27T00:42:39Z: rustc_mir::util::liveness: Liveness dataflow converged after 19 iterations (26.666666666666668% overhead)
DEBUG 2019-06-27T00:42:40Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (0% overhead)
DEBUG 2019-06-27T00:42:40Z: rustc_mir::util::liveness: Liveness dataflow converged after 24 iterations (4.3478260869565215% overhead)
DEBUG 2019-06-27T00:42:40Z: rustc_mir::util::liveness: Liveness dataflow converged after 18 iterations (0% overhead)
DEBUG 2019-06-27T00:42:40Z: rustc_mir::util::liveness: Liveness dataflow converged after 6 iterations (0% overhead)
DEBUG 2019-06-27T00:42:41Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (0% overhead)
DEBUG 2019-06-27T00:42:41Z: rustc_mir::util::liveness: Liveness dataflow converged after 38 iterations (0% overhead)
DEBUG 2019-06-27T00:42:42Z: rustc_mir::util::liveness: Liveness dataflow converged after 13 iterations (0% overhead)
DEBUG 2019-06-27T00:42:42Z: rustc_mir::util::liveness: Liveness dataflow converged after 14 iterations (0% overhead)
DEBUG 2019-06-27T00:42:42Z: rustc_mir::util::liveness: Liveness dataflow converged after 9 iterations (0% overhead)
DEBUG 2019-06-27T00:42:43Z: rustc_mir::util::liveness: Liveness dataflow converged after 6 iterations (0% overhead)
DEBUG 2019-06-27T00:42:43Z: rustc_mir::util::liveness: Liveness dataflow converged after 6 iterations (0% overhead)
DEBUG 2019-06-27T00:42:44Z: rustc_mir::util::liveness: Liveness dataflow converged after 8 iterations (0% overhead)
DEBUG 2019-06-27T00:42:44Z: rustc_mir::util::liveness: Liveness dataflow converged after 17 iterations (0% overhead)
DEBUG 2019-06-27T00:42:45Z: rustc_mir::util::liveness: Liveness dataflow converged after 6 iterations (0% overhead)
DEBUG 2019-06-27T00:42:45Z: rustc_mir::util::liveness: Liveness dataflow converged after 14 iterations (0% overhead)
DEBUG 2019-06-27T00:42:46Z: rustc_mir::util::liveness: Liveness dataflow converged after 6 iterations (20% overhead)

@pnkfelix
Copy link
Member

This seems fine to me. Its currently marked waiting-on-author, but I don't really have much to add as a reviewer.

@ecstatic-morse
Copy link
Contributor Author

@pnkfelix I think this one should definitely be merged, even if #62062 is not. Let me squash first though.

This applies the same basic principle as rust-lang#62062 to the reverse dataflow
analysis used to compute liveness information. It is functionally
equivalent, except that post-order is used instead of reverse post-order.

Some `mir::Body`s contain basic blocks which are not reachable from the
`START_BLOCK`. We need to add them to the work queue as well to preserve
the original semantics.
@nagisa
Copy link
Member

nagisa commented Jun 29, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jun 29, 2019

📌 Commit e2479e2 has been approved by nagisa

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 29, 2019
Centril added a commit to Centril/rust that referenced this pull request Jun 30, 2019
…der, r=nagisa

Use a more efficient iteration order for backward dataflow

This applies the same basic principle as rust-lang#62062 to the reverse dataflow analysis used to compute liveness information. It is functionally equivalent, except that post-order is used instead of reverse post-order.

In the long-term, `BitDenotation` should probably be extended to support both forward and backward dataflow, but there's some more work needed to get to that point.
bors added a commit that referenced this pull request Jul 1, 2019
Rollup of 8 pull requests

Successful merges:

 - #62062 (Use a more efficient iteration order for forward dataflow)
 - #62063 (Use a more efficient iteration order for backward dataflow)
 - #62224 (rustdoc: remove unused derives and variants)
 - #62228 (Extend the #[must_use] lint to boxed types)
 - #62235 (Extend the `#[must_use]` lint to arrays)
 - #62239 (Fix a typo)
 - #62241 (Always parse 'async unsafe fn' + properly ban in 2015)
 - #62248 (before_exec actually will only get deprecated with 1.37)

Failed merges:

r? @ghost
@bors bors merged commit e2479e2 into rust-lang:master Jul 1, 2019
@ecstatic-morse ecstatic-morse deleted the dataflow-backward-order branch July 1, 2019 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants