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

Add a Use-Definition Chain implementation for the MIR. #62547

Closed
wants to merge 13 commits into from

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Jul 9, 2019

This work began from a discussion about extending const-qualification to work on arbitrary CFGs (currently it does not support conditional jumps). @eddyb was not convinced that this was the right approach, so I stopped working on it for a while. I picked it up again since it was almost complete, and it might also be useful for MIR optimization. I'm opening this PR so there's a place to discuss possible use cases, but it's very much a work in progress.

You can see an example of this analysis here. The ERROR lines contain the possible definitions of the given variable at that point in the program prefixed by their line number. Note the presence of rustc_peek(&x) in the possible definitions on line 25. This is because function calls may mutate locals higher up the call stack via a pointer, so any local which has had its address taken at that point in the CFG could be modified when calling an arbitrary function (obviously rustc_peek does not actually mutate its environment). The fact that rustc_peek does not mutate its environment has been special-cased in the analysis (this could be extended to other intrinsics).

@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 Jul 9, 2019
@ecstatic-morse
Copy link
Contributor Author

r? @eddyb cc @pcwalton, @wesleywiser (for MIR-opt)

@rust-highfive rust-highfive assigned eddyb and unassigned varkor Jul 9, 2019
@ecstatic-morse ecstatic-morse force-pushed the ud-chain branch 2 times, most recently from 2409e5c to 88921e6 Compare July 10, 2019 00:01
@rust-highfive
Copy link
Collaborator

The job Job1 of your PR failed (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.
2019-07-10T00:02:24.3411251Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-07-10T00:02:24.3646561Z ##[command]git config gc.auto 0
2019-07-10T00:02:24.3722949Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-07-10T00:02:24.3783766Z ##[command]git config --get-all http.proxy
2019-07-10T00:02:24.3926592Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/62547/merge:refs/remotes/pull/62547/merge
---
2019-07-10T00:02:59.5207287Z do so (now or later) by using -b with the checkout command again. Example:
2019-07-10T00:02:59.5207331Z 
2019-07-10T00:02:59.5209603Z   git checkout -b <new-branch-name>
2019-07-10T00:02:59.5209837Z 
2019-07-10T00:02:59.5209890Z HEAD is now at eaf4f47e2 Merge 88921e6e5b85987de66361cae8781f567c26ee9b into 0b680cfce544ff9a59d720020e397c4bf3346650
2019-07-10T00:02:59.5355295Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-07-10T00:02:59.5358038Z ==============================================================================
2019-07-10T00:02:59.5358115Z Task         : Bash
2019-07-10T00:02:59.5358164Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-07-10T00:04:36.1902764Z Attempting with retry: curl -y 30 -Y 10 --connect-timeout 30 -f -L -C - -o /tmp/rustci_docker_cache https://.s3.amazonaws.com/docker/c7688a42c3598c0b7dfe0f9f69838f24b25841ef6f7f87b4686f4da367d970f5a477b9c1277bdc58ebfc14a49c51c0e2ddb2b3366d867d7aae1de3d9233c8624
2019-07-10T00:04:36.1969865Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-10T00:04:36.1970935Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-10T00:04:36.1970984Z 
2019-07-10T00:04:36.2002901Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-10T00:04:37.2070447Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-10T00:04:37.2070872Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-10T00:04:37.2080079Z 
2019-07-10T00:04:37.2080079Z 
2019-07-10T00:04:37.2117637Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-10T00:04:39.2186415Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-10T00:04:39.2220396Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-10T00:04:39.2220707Z 
2019-07-10T00:04:39.2220707Z 
2019-07-10T00:04:39.2221931Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-10T00:04:42.2322395Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-10T00:04:42.2323134Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-10T00:04:42.2323357Z 
2019-07-10T00:04:42.2323357Z 
2019-07-10T00:04:42.2324468Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-10T00:04:46.2397793Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-10T00:04:46.2398224Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-10T00:04:46.2398500Z 
2019-07-10T00:04:46.2398500Z 
2019-07-10T00:04:46.2441236Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-10T00:04:46.2445640Z The command has failed after 5 attempts.
2019-07-10T00:04:46.3820380Z open /tmp/rustci_docker_cache: no such file or directory
2019-07-10T00:04:46.3865725Z Attempting with retry: docker build --rm -t rust-ci -f /home/vsts/work/1/s/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile /home/vsts/work/1/s/src/ci/docker
2019-07-10T00:04:46.5184903Z Sending build context to Docker daemon  521.7kB
2019-07-10T00:04:46.5185609Z 
2019-07-10T00:04:46.5424522Z Step 1/8 : FROM ubuntu:16.04
---
2019-07-10T00:05:01.8544122Z Reading package lists...
2019-07-10T00:05:02.9861549Z Reading package lists...
2019-07-10T00:05:03.2286875Z Building dependency tree...
2019-07-10T00:05:03.2287717Z Reading state information...
2019-07-10T00:05:03.3570859Z The following additional packages will be installed:
2019-07-10T00:05:03.3572626Z   binfmt-support binutils bzip2 cmake-data cpp cpp-5 dpkg-dev g++-5 gcc gcc-5
2019-07-10T00:05:03.3573387Z   git-man libarchive13 libasan2 libasn1-8-heimdal libatomic1
2019-07-10T00:05:03.3573989Z   libbabeltrace-ctf1 libbabeltrace1 libbsd-dev libbsd0 libbz2-1.0 libc-dev-bin
2019-07-10T00:05:03.3596817Z   libedit2 liberror-perl libexpat1 libffi-dev libffi6 libgcc-5-dev libgdbm3
2019-07-10T00:05:03.3597559Z   libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgssapi-krb5-2
2019-07-10T00:05:03.3598155Z   libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
2019-07-10T00:05:03.3598743Z   libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11
2019-07-10T00:05:03.3598743Z   libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11
2019-07-10T00:05:03.3600685Z   libisl15 libitm1 libjsoncpp1 libk5crypto3 libkeyutils1 libkrb5-26-heimdal
2019-07-10T00:05:03.3601432Z   libkrb5-3 libkrb5support0 libldap-2.4-2 libllvm6.0 liblsan0 liblzo2-2
2019-07-10T00:05:03.3602787Z   libmagic1 libmpc3 libmpdec2 libmpfr4 libmpx0 libnettle6 libp11-kit0
2019-07-10T00:05:03.3603397Z   libperl5.22 libpipeline1 libpython-stdlib libpython2.7-minimal
2019-07-10T00:05:03.3604341Z   libpython2.7-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib
2019-07-10T00:05:03.3605889Z   libquadmath0 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules-db
2019-07-10T00:05:03.3607248Z   libsqlite3-0 libssl1.0.0 libstdc++-5-dev libtasn1-6 libtinfo-dev libtsan0
2019-07-10T00:05:03.3608634Z   libubsan0 libwind0-heimdal libxml2 linux-libc-dev llvm-6.0 llvm-6.0-dev
2019-07-10T00:05:03.3609891Z   llvm-6.0-runtime mime-support openssl patch perl perl-modules-5.22 python
2019-07-10T00:05:03.3612020Z   python-minimal python2.7-minimal
2019-07-10T00:05:03.3612330Z Suggested packages:
2019-07-10T00:05:03.3613352Z   binutils-doc bzip2-doc codeblocks eclipse ninja-build cpp-doc gcc-5-locales
2019-07-10T00:05:03.3614015Z   debian-keyring g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg
2019-07-10T00:05:03.3614443Z   gcc-multilib manpages-dev autoconf automake libtool flex bison gcc-doc
2019-07-10T00:05:03.3615824Z   libasan2-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
2019-07-10T00:05:03.3616375Z   libmpx0-dbg libquadmath0-dbg gdb-doc gettext-base git-daemon-run
2019-07-10T00:05:03.3616375Z   libmpx0-dbg libquadmath0-dbg gdb-doc gettext-base git-daemon-run
2019-07-10T00:05:03.3617230Z   | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch
2019-07-10T00:05:03.3617968Z   git-cvs git-mediawiki git-svn lrzip glibc-doc gnutls-bin krb5-doc krb5-user
2019-07-10T00:05:03.3619269Z   libstdc++-5-doc llvm-6.0-doc make-doc ed diffutils-doc perl-doc
2019-07-10T00:05:03.3619784Z   libterm-readline-gnu-perl | libterm-readline-perl-perl python-doc python-tk
2019-07-10T00:05:03.3621780Z   python2.7-doc
2019-07-10T00:05:03.3622101Z Recommended packages:
2019-07-10T00:05:03.3622501Z   build-essential fakeroot libalgorithm-merge-perl libc-dbg gdbserver less
2019-07-10T00:05:03.3622903Z   rsync ssh-client manpages manpages-dev libfile-fcntllock-perl
2019-07-10T00:05:03.3623379Z   libglib2.0-data shared-mime-info xdg-user-dirs krb5-locales libsasl2-modules
2019-07-10T00:05:03.3623746Z   libssl-doc xml-core netbase rename
2019-07-10T00:05:03.3624110Z The following NEW packages will be installed:
2019-07-10T00:05:03.3624705Z   binfmt-support binutils bzip2 ca-certificates cmake cmake-data cpp cpp-5
2019-07-10T00:05:03.3625118Z   curl dpkg-dev file g++ g++-5 gcc gcc-5 gdb git git-man libarchive13 libasan2
2019-07-10T00:05:03.3625610Z   libasn1-8-heimdal libatomic1 libbabeltrace-ctf1 libbabeltrace1 libbsd-dev
2019-07-10T00:05:03.3626178Z   libbsd0 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libcurl3 libcurl3-gnutls
2019-07-10T00:05:03.3627215Z   libdpkg-perl libedit-dev libedit2 liberror-perl libexpat1 libffi-dev libffi6
2019-07-10T00:05:03.3628267Z   libgcc-5-dev libgdbm3 libglib2.0-0 libgmp10 libgnutls30 libgomp1
2019-07-10T00:05:03.3629157Z   libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11
2019-07-10T00:05:03.3629730Z   libisl15 libitm1 libjsoncpp1 libk5crypto3 libkeyutils1 libkrb5-26-heimdal
2019-07-10T00:05:03.3630120Z   libkrb5-3 libkrb5support0 libldap-2.4-2 libllvm6.0 liblsan0 liblzo2-2
2019-07-10T00:05:03.3631019Z   libmagic1 libmpc3 libmpdec2 libmpfr4 libmpx0 libnettle6 libp11-kit0
2019-07-10T00:05:03.3631019Z   libmagic1 libmpc3 libmpdec2 libmpfr4 libmpx0 libnettle6 libp11-kit0
2019-07-10T00:05:03.3631491Z   libperl5.22 libpipeline1 libpython-stdlib libpython2.7-minimal
2019-07-10T00:05:03.3631956Z   libpython2.7-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib
2019-07-10T00:05:03.3632394Z   libquadmath0 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules-db
2019-07-10T00:05:03.3632816Z   libsqlite3-0 libssl-dev libssl1.0.0 libstdc++-5-dev libtasn1-6 libtinfo-dev
2019-07-10T00:05:03.3633282Z   libtsan0 libubsan0 libwind0-heimdal libxml2 linux-libc-dev llvm-6.0
2019-07-10T00:05:03.3633702Z   llvm-6.0-dev llvm-6.0-runtime llvm-6.0-tools make mime-support openssl patch
2019-07-10T00:05:03.3634259Z   perl perl-modules-5.22 pkg-config python python-minimal python2.7
2019-07-10T00:05:03.3634679Z   python2.7-minimal sudo xz-utils zlib1g-dev
2019-07-10T00:05:03.3634863Z The following packages will be upgraded:
2019-07-10T00:05:04.0035525Z 1 upgraded, 115 newly installed, 0 to remove and 4 not upgraded.
2019-07-10T00:05:04.0035724Z Need to get 121 MB of archives.
2019-07-10T00:05:04.0036255Z After this operation, 592 MB of additional disk space will be used.
2019-07-10T00:05:04.0037148Z Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgdbm3 amd64 1.8.3-13.1 [16.9 kB]
---
2019-07-10T00:05:06.4584873Z Get:61 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 sudo amd64 1.8.16-0ubuntu1.7 [390 kB]
2019-07-10T00:05:06.5228859Z Get:62 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssl amd64 1.0.2g-1ubuntu4.15 [492 kB]
2019-07-10T00:05:06.5306912Z Get:63 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 ca-certificates all 20170717~16.04.2 [167 kB]
2019-07-10T00:05:06.5336074Z Get:64 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcurl3-gnutls amd64 7.47.0-1ubuntu2.13 [184 kB]
2019-07-10T00:05:06.5365260Z Get:65 http://archive.ubuntu.com/ubuntu xenial/main amd64 libedit2 amd64 3.1-20150325-1ubuntu2 [76.5 kB]
2019-07-10T00:05:06.5381228Z Get:66 http://archive.ubuntu.com/ubuntu xenial/main amd64 libpipeline1 amd64 1.4.1-2 [24.6 kB]
2019-07-10T00:05:06.5399075Z Get:67 http://archive.ubuntu.com/ubuntu xenial/main amd64 binfmt-support amd64 2.1.6-1 [50.7 kB]
2019-07-10T00:05:06.6647415Z Get:69 http://archive.ubuntu.com/ubuntu xenial/main amd64 libisl15 amd64 0.16.1-1 [524 kB]
2019-07-10T00:05:06.6719909Z Get:70 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 cpp-5 amd64 5.4.0-6ubuntu1~16.04.11 [7660 kB]
2019-07-10T00:05:06.9951501Z Get:71 http://archive.ubuntu.com/ubuntu xenial/main amd64 cpp amd64 4:5.3.1-1ubuntu1 [27.7 kB]
2019-07-10T00:05:06.9958047Z Get:72 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 curl amd64 7.47.0-1ubuntu2.13 [139 kB]
---
2019-07-10T00:05:27.0195116Z Unpacking ca-certificates (20170717~16.04.2) ...
2019-07-10T00:05:27.1877957Z Selecting previously unselected package libcurl3-gnutls:amd64.
2019-07-10T00:05:27.1894384Z Preparing to unpack .../libcurl3-gnutls_7.47.0-1ubuntu2.13_amd64.deb ...
2019-07-10T00:05:27.2006428Z Unpacking libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.13) ...
2019-07-10T00:05:27.3259880Z Selecting previously unselected package libedit2:amd64.
2019-07-10T00:05:27.3278024Z Preparing to unpack .../libedit2_3.1-20150325-1ubuntu2_amd64.deb ...
2019-07-10T00:05:27.3390629Z Unpacking libedit2:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-10T00:05:27.4523005Z Selecting previously unselected package libpipeline1:amd64.
2019-07-10T00:05:27.4539347Z Preparing to unpack .../libpipeline1_1.4.1-2_amd64.deb ...
2019-07-10T00:05:27.4672620Z Unpacking libpipeline1:amd64 (1.4.1-2) ...
2019-07-10T00:05:27.5953875Z Selecting previously unselected package binfmt-support.
2019-07-10T00:05:27.5970193Z Preparing to unpack .../binfmt-support_2.1.6-1_amd64.deb ...
2019-07-10T00:05:27.6086006Z Unpacking binfmt-support (2.1.6-1) ...
2019-07-10T00:05:27.7136213Z Preparing to unpack .../binutils_2.26.1-1ubuntu1~16.04.8_amd64.deb ...
2019-07-10T00:05:27.7255063Z Unpacking binutils (2.26.1-1ubuntu1~16.04.8) ...
2019-07-10T00:05:28.2130503Z Selecting previously unselected package libisl15:amd64.
2019-07-10T00:05:28.2143257Z Preparing to unpack .../libisl15_0.16.1-1_amd64.deb ...
---
2019-07-10T00:05:39.9383670Z Selecting previously unselected package libtinfo-dev:amd64.
2019-07-10T00:05:39.9403716Z Preparing to unpack .../libtinfo-dev_6.0+20160213-1ubuntu1_amd64.deb ...
2019-07-10T00:05:39.9545931Z Unpacking libtinfo-dev:amd64 (6.0+20160213-1ubuntu1) ...
2019-07-10T00:05:40.0544636Z Selecting previously unselected package libedit-dev:amd64.
2019-07-10T00:05:40.0563661Z Preparing to unpack .../libedit-dev_3.1-20150325-1ubuntu2_amd64.deb ...
2019-07-10T00:05:40.0707258Z Unpacking libedit-dev:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-10T00:05:40.2064059Z Selecting previously unselected package libllvm6.0:amd64.
2019-07-10T00:05:40.2082454Z Preparing to unpack .../libllvm6.0_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-10T00:05:40.2187758Z Unpacking libllvm6.0:amd64 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:43.2965536Z Selecting previously unselected package zlib1g-dev:amd64.
2019-07-10T00:05:43.3002686Z Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2ubuntu4.1_amd64.deb ...
2019-07-10T00:05:43.3113179Z Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
2019-07-10T00:05:43.4149540Z Preparing to unpack .../libssl-dev_1.0.2g-1ubuntu4.15_amd64.deb ...
2019-07-10T00:05:43.4307242Z Unpacking libssl-dev:amd64 (1.0.2g-1ubuntu4.15) ...
2019-07-10T00:05:43.7529658Z Selecting previously unselected package llvm-6.0-runtime.
2019-07-10T00:05:43.7529658Z Selecting previously unselected package llvm-6.0-runtime.
2019-07-10T00:05:43.7530097Z Preparing to unpack .../llvm-6.0-runtime_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-10T00:05:43.7633957Z Unpacking llvm-6.0-runtime (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:43.8737934Z Selecting previously unselected package llvm-6.0.
2019-07-10T00:05:43.8753865Z Preparing to unpack .../llvm-6.0_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-10T00:05:43.8923378Z Unpacking llvm-6.0 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:44.5227184Z Selecting previously unselected package libffi-dev:amd64.
2019-07-10T00:05:44.5247360Z Preparing to unpack .../libffi-dev_3.2.1-4_amd64.deb ...
2019-07-10T00:05:44.5360188Z Unpacking libffi-dev:amd64 (3.2.1-4) ...
2019-07-10T00:05:44.6462721Z Selecting previously unselected package llvm-6.0-dev.
2019-07-10T00:05:44.6482304Z Preparing to unpack .../llvm-6.0-dev_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-10T00:05:44.6586697Z Unpacking llvm-6.0-dev (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:49.4517316Z Selecting previously unselected package llvm-6.0-tools.
2019-07-10T00:05:49.4541791Z Preparing to unpack .../llvm-6.0-tools_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-10T00:05:49.4656100Z Unpacking llvm-6.0-tools (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:49.6091027Z Selecting previously unselected package pkg-config.
2019-07-10T00:05:49.6117703Z Preparing to unpack .../pkg-config_0.29.1-0ubuntu1_amd64.deb ...
2019-07-10T00:05:49.6250742Z Unpacking pkg-config (0.29.1-0ubuntu1) ...
2019-07-10T00:05:49.7358338Z Processing triggers for systemd (229-4ubuntu21.21) ...
2019-07-10T00:05:50.0414254Z Setting up libgdbm3:amd64 (1.8.3-13.1) ...
2019-07-10T00:05:50.1199092Z Setting up libffi6:amd64 (3.2.1-4) ...
2019-07-10T00:05:50.1540910Z Setting up libglib2.0-0:amd64 (2.48.2-0ubuntu4.3) ...
---
2019-07-10T00:05:53.7251494Z debconf: unable to initialize frontend: Dialog
2019-07-10T00:05:53.7251683Z debconf: (TERM is not set, so the dialog frontend is not usable.)
2019-07-10T00:05:53.7251778Z debconf: falling back to frontend: Readline
2019-07-10T00:05:54.4405279Z Setting up libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.13) ...
2019-07-10T00:05:54.4738874Z Setting up libedit2:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-10T00:05:54.5075266Z Setting up libpipeline1:amd64 (1.4.1-2) ...
2019-07-10T00:05:54.5397830Z Setting up binfmt-support (2.1.6-1) ...
2019-07-10T00:05:54.6043573Z mount: permission denied
2019-07-10T00:05:54.6044522Z update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
2019-07-10T00:05:54.6057131Z mount: permission denied
2019-07-10T00:05:54.6062357Z update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
2019-07-10T00:05:54.7698921Z invoke-rc.d: could not determine current runlevel
2019-07-10T00:05:54.7730333Z invoke-rc.d: policy-rc.d denied execution of start.
2019-07-10T00:05:54.8275273Z Setting up libisl15:amd64 (0.16.1-1) ...
2019-07-10T00:05:54.8677380Z Setting up cpp-5 (5.4.0-6ubuntu1~16.04.11) ...
2019-07-10T00:05:54.9026401Z Setting up cpp (4:5.3.1-1ubuntu1) ...
2019-07-10T00:05:54.9446418Z Setting up curl (7.47.0-1ubuntu2.13) ...
---
2019-07-10T00:05:56.3654052Z Setting up libedit-dev:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-10T00:05:56.3985056Z Setting up libllvm6.0:amd64 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:56.4402423Z Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
2019-07-10T00:05:56.4865643Z Setting up libssl-dev:amd64 (1.0.2g-1ubuntu4.15) ...
2019-07-10T00:05:56.5208151Z Setting up llvm-6.0-runtime (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:56.5449921Z mount: permission denied
2019-07-10T00:05:56.5454097Z update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
2019-07-10T00:05:56.5566115Z Setting up llvm-6.0 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:56.5891497Z Setting up libffi-dev:amd64 (3.2.1-4) ...
2019-07-10T00:05:56.6245543Z Setting up llvm-6.0-dev (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:56.6603067Z Setting up llvm-6.0-tools (1:6.0-1ubuntu2~16.04.1) ...
2019-07-10T00:05:56.6933693Z Setting up pkg-config (0.29.1-0ubuntu1) ...
2019-07-10T00:05:56.8438612Z Processing triggers for ca-certificates (20170717~16.04.2) ...
2019-07-10T00:05:56.8591525Z Updating certificates in /etc/ssl/certs...
2019-07-10T00:05:58.5505682Z 148 added, 0 removed; done.
2019-07-10T00:05:58.5507807Z Running hooks in /etc/ca-certificates/update.d...
---
2019-07-10T00:06:32.4673012Z Removing intermediate container d49966615bdd
2019-07-10T00:06:32.4674544Z  ---> c8c03bce2cb5
2019-07-10T00:06:32.4715769Z Successfully built c8c03bce2cb5
2019-07-10T00:06:32.6452011Z Successfully tagged rust-ci:latest
2019-07-10T00:06:32.7062671Z Built container sha256:c8c03bce2cb5a9551f4df3d23fc9aea3c7462412a2464cad1caca8ca9c7fdc8e
2019-07-10T00:06:32.7083670Z Uploading finished image to https://.s3.amazonaws.com/docker/c7688a42c3598c0b7dfe0f9f69838f24b25841ef6f7f87b4686f4da367d970f5a477b9c1277bdc58ebfc14a49c51c0e2ddb2b3366d867d7aae1de3d9233c8624
2019-07-10T00:07:37.8431214Z upload failed: - to s3:///docker/c7688a42c3598c0b7dfe0f9f69838f24b25841ef6f7f87b4686f4da367d970f5a477b9c1277bdc58ebfc14a49c51c0e2ddb2b3366d867d7aae1de3d9233c8624 Parameter validation failed:
2019-07-10T00:07:37.8431734Z Invalid bucket name "": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$"
2019-07-10T00:07:38.8359880Z [CI_JOB_NAME=Job1]
2019-07-10T00:07:38.8423772Z Starting sccache server...
2019-07-10T00:07:38.9049898Z configure: processing command line
2019-07-10T00:07:38.9050014Z configure: 
---
2019-07-10T00:11:28.0610598Z    Compiling serde_json v1.0.33
2019-07-10T00:11:32.6384538Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-07-10T00:11:42.0467791Z     Finished release [optimized] target(s) in 1m 39s
2019-07-10T00:11:42.0532906Z tidy check
2019-07-10T00:11:42.3447265Z tidy error: /checkout/src/librustc_mir/dataflow/impls/reaching_defs.rs:172: TODO is deprecated; use FIXME
2019-07-10T00:11:43.9649274Z some tidy checks failed
2019-07-10T00:11:43.9650322Z 
2019-07-10T00:11:43.9650322Z 
2019-07-10T00:11:43.9651665Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-07-10T00:11:43.9652240Z 
2019-07-10T00:11:43.9652358Z 
2019-07-10T00:11:43.9652529Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-07-10T00:11:43.9653202Z Build completed unsuccessfully in 0:01:42
2019-07-10T00:11:43.9653202Z Build completed unsuccessfully in 0:01:42
2019-07-10T00:11:45.3192603Z ##[error]Bash exited with code '1'.
2019-07-10T00:11:45.3239915Z ##[section]Starting: Checkout
2019-07-10T00:11:45.3241548Z ==============================================================================
2019-07-10T00:11:45.3241602Z Task         : Get sources
2019-07-10T00:11:45.3242049Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@ecstatic-morse ecstatic-morse force-pushed the ud-chain branch 2 times, most recently from 76673aa to 1c02ee7 Compare July 10, 2019 00:39
@ecstatic-morse

This comment has been minimized.

@eddyb
Copy link
Member

eddyb commented Jul 11, 2019

cc @pnkfelix @davidtwco @matthewjasper (just in case)

I also wanted to note here that I think "use-def" is not ideal given our far-from-SSA nature (@nikomatsakis might want to comment on this), and "reaching def" is closer, but IMO "reaching writes" for the analysis and "write sets" for the output seem better.

@ecstatic-morse ecstatic-morse force-pushed the ud-chain branch 3 times, most recently from 4fcbd4f to fa2b191 Compare July 13, 2019 01:06
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-07-13T22:08:27.1049148Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-07-13T22:08:28.0059218Z ##[command]git config gc.auto 0
2019-07-13T22:08:28.0066100Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-07-13T22:08:28.0068279Z ##[command]git config --get-all http.proxy
2019-07-13T22:08:28.0071939Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/62547/merge:refs/remotes/pull/62547/merge
---
2019-07-13T22:09:00.8197347Z do so (now or later) by using -b with the checkout command again. Example:
2019-07-13T22:09:00.8197383Z 
2019-07-13T22:09:00.8197608Z   git checkout -b <new-branch-name>
2019-07-13T22:09:00.8197639Z 
2019-07-13T22:09:00.8197710Z HEAD is now at 313e1de80 Merge b7157819b7e3f64991eb13d0cde897fbe7b44181 into 69656fa4cbafc378fd63f9186d93b0df3cdd9320
2019-07-13T22:09:00.8365462Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-07-13T22:09:00.8461372Z ==============================================================================
2019-07-13T22:09:00.8461453Z Task         : Bash
2019-07-13T22:09:00.8461500Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-07-13T22:10:53.4397589Z Attempting with retry: curl -y 30 -Y 10 --connect-timeout 30 -f -L -C - -o /tmp/rustci_docker_cache https://.s3.amazonaws.com/docker/c7688a42c3598c0b7dfe0f9f69838f24b25841ef6f7f87b4686f4da367d970f5a477b9c1277bdc58ebfc14a49c51c0e2ddb2b3366d867d7aae1de3d9233c8624
2019-07-13T22:10:53.4479716Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-13T22:10:53.4480019Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-13T22:10:53.4480056Z 
2019-07-13T22:10:53.4480639Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-13T22:10:54.4556428Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-13T22:10:54.4556974Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-13T22:10:54.4557146Z 
2019-07-13T22:10:54.4557146Z 
2019-07-13T22:10:54.4600968Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-13T22:10:56.4676931Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-13T22:10:56.4677028Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-13T22:10:56.4677068Z 
2019-07-13T22:10:56.4677068Z 
2019-07-13T22:10:56.4720968Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-13T22:10:59.4804367Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-13T22:10:59.4805743Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-13T22:10:59.4812645Z 
2019-07-13T22:10:59.4812645Z 
2019-07-13T22:10:59.4848059Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-13T22:11:03.4930331Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2019-07-13T22:11:03.4930959Z                                  Dload  Upload   Total   Spent    Left  Speed
2019-07-13T22:11:03.4931271Z 
2019-07-13T22:11:03.4931271Z 
2019-07-13T22:11:03.4976245Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: .s3.amazonaws.com
2019-07-13T22:11:03.4979686Z The command has failed after 5 attempts.
2019-07-13T22:11:03.6600555Z open /tmp/rustci_docker_cache: no such file or directory
2019-07-13T22:11:03.6636230Z Attempting with retry: docker build --rm -t rust-ci -f /home/vsts/work/1/s/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile /home/vsts/work/1/s/src/ci/docker
2019-07-13T22:11:03.8522925Z Sending build context to Docker daemon  521.7kB
2019-07-13T22:11:03.8523136Z 
2019-07-13T22:11:03.8742323Z Step 1/8 : FROM ubuntu:16.04
---
2019-07-13T22:11:20.1149309Z Reading package lists...
2019-07-13T22:11:21.0982580Z Reading package lists...
2019-07-13T22:11:21.2912771Z Building dependency tree...
2019-07-13T22:11:21.2912897Z Reading state information...
2019-07-13T22:11:21.4161861Z The following additional packages will be installed:
2019-07-13T22:11:21.4162722Z   binfmt-support binutils bzip2 cmake-data cpp cpp-5 dpkg-dev g++-5 gcc gcc-5
2019-07-13T22:11:21.4163137Z   git-man libarchive13 libasan2 libasn1-8-heimdal libatomic1
2019-07-13T22:11:21.4163495Z   libbabeltrace-ctf1 libbabeltrace1 libbsd-dev libbsd0 libbz2-1.0 libc-dev-bin
2019-07-13T22:11:21.4164093Z   libedit2 liberror-perl libexpat1 libffi-dev libffi6 libgcc-5-dev libgdbm3
2019-07-13T22:11:21.4164368Z   libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgssapi-krb5-2
2019-07-13T22:11:21.4164627Z   libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
2019-07-13T22:11:21.4164968Z   libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11
2019-07-13T22:11:21.4164968Z   libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11
2019-07-13T22:11:21.4169150Z   libisl15 libitm1 libjsoncpp1 libk5crypto3 libkeyutils1 libkrb5-26-heimdal
2019-07-13T22:11:21.4169590Z   libkrb5-3 libkrb5support0 libldap-2.4-2 libllvm6.0 liblsan0 liblzo2-2
2019-07-13T22:11:21.4169936Z   libmagic1 libmpc3 libmpdec2 libmpfr4 libmpx0 libnettle6 libp11-kit0
2019-07-13T22:11:21.4170561Z   libperl5.22 libpipeline1 libpython-stdlib libpython2.7-minimal
2019-07-13T22:11:21.4170845Z   libpython2.7-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib
2019-07-13T22:11:21.4171160Z   libquadmath0 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules-db
2019-07-13T22:11:21.4171769Z   libsqlite3-0 libssl1.0.0 libstdc++-5-dev libtasn1-6 libtinfo-dev libtsan0
2019-07-13T22:11:21.4172145Z   libubsan0 libwind0-heimdal libxml2 linux-libc-dev llvm-6.0 llvm-6.0-dev
2019-07-13T22:11:21.4172465Z   llvm-6.0-runtime mime-support openssl patch perl perl-modules-5.22 python
2019-07-13T22:11:21.4172717Z   python-minimal python2.7-minimal
2019-07-13T22:11:21.4172786Z Suggested packages:
2019-07-13T22:11:21.4173065Z   binutils-doc bzip2-doc codeblocks eclipse ninja-build cpp-doc gcc-5-locales
2019-07-13T22:11:21.4173387Z   debian-keyring g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg
2019-07-13T22:11:21.4173655Z   gcc-multilib manpages-dev autoconf automake libtool flex bison gcc-doc
2019-07-13T22:11:21.4174271Z   libasan2-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
2019-07-13T22:11:21.4174538Z   libmpx0-dbg libquadmath0-dbg gdb-doc gettext-base git-daemon-run
2019-07-13T22:11:21.4174538Z   libmpx0-dbg libquadmath0-dbg gdb-doc gettext-base git-daemon-run
2019-07-13T22:11:21.4174812Z   | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch
2019-07-13T22:11:21.4175158Z   git-cvs git-mediawiki git-svn lrzip glibc-doc gnutls-bin krb5-doc krb5-user
2019-07-13T22:11:21.4175423Z   libstdc++-5-doc llvm-6.0-doc make-doc ed diffutils-doc perl-doc
2019-07-13T22:11:21.4175710Z   libterm-readline-gnu-perl | libterm-readline-perl-perl python-doc python-tk
2019-07-13T22:11:21.4175989Z   python2.7-doc
2019-07-13T22:11:21.4176041Z Recommended packages:
2019-07-13T22:11:21.4176308Z   build-essential fakeroot libalgorithm-merge-perl libc-dbg gdbserver less
2019-07-13T22:11:21.4176629Z   rsync ssh-client manpages manpages-dev libfile-fcntllock-perl
2019-07-13T22:11:21.4176925Z   libglib2.0-data shared-mime-info xdg-user-dirs krb5-locales libsasl2-modules
2019-07-13T22:11:21.4177160Z   libssl-doc xml-core netbase rename
2019-07-13T22:11:21.4177267Z The following NEW packages will be installed:
2019-07-13T22:11:21.4177575Z   binfmt-support binutils bzip2 ca-certificates cmake cmake-data cpp cpp-5
2019-07-13T22:11:21.4178220Z   curl dpkg-dev file g++ g++-5 gcc gcc-5 gdb git git-man libarchive13 libasan2
2019-07-13T22:11:21.4178588Z   libasn1-8-heimdal libatomic1 libbabeltrace-ctf1 libbabeltrace1 libbsd-dev
2019-07-13T22:11:21.4178871Z   libbsd0 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libcurl3 libcurl3-gnutls
2019-07-13T22:11:21.4179312Z   libdpkg-perl libedit-dev libedit2 liberror-perl libexpat1 libffi-dev libffi6
2019-07-13T22:11:21.4179708Z   libgcc-5-dev libgdbm3 libglib2.0-0 libgmp10 libgnutls30 libgomp1
2019-07-13T22:11:21.4180266Z   libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11
2019-07-13T22:11:21.4180624Z   libisl15 libitm1 libjsoncpp1 libk5crypto3 libkeyutils1 libkrb5-26-heimdal
2019-07-13T22:11:21.4180899Z   libkrb5-3 libkrb5support0 libldap-2.4-2 libllvm6.0 liblsan0 liblzo2-2
2019-07-13T22:11:21.4181170Z   libmagic1 libmpc3 libmpdec2 libmpfr4 libmpx0 libnettle6 libp11-kit0
2019-07-13T22:11:21.4181170Z   libmagic1 libmpc3 libmpdec2 libmpfr4 libmpx0 libnettle6 libp11-kit0
2019-07-13T22:11:21.4181494Z   libperl5.22 libpipeline1 libpython-stdlib libpython2.7-minimal
2019-07-13T22:11:21.4181771Z   libpython2.7-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib
2019-07-13T22:11:21.4182047Z   libquadmath0 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules-db
2019-07-13T22:11:21.4182379Z   libsqlite3-0 libssl-dev libssl1.0.0 libstdc++-5-dev libtasn1-6 libtinfo-dev
2019-07-13T22:11:21.4182653Z   libtsan0 libubsan0 libwind0-heimdal libxml2 linux-libc-dev llvm-6.0
2019-07-13T22:11:21.4182932Z   llvm-6.0-dev llvm-6.0-runtime llvm-6.0-tools make mime-support openssl patch
2019-07-13T22:11:21.4183260Z   perl perl-modules-5.22 pkg-config python python-minimal python2.7
2019-07-13T22:11:21.4183649Z   python2.7-minimal sudo xz-utils zlib1g-dev
2019-07-13T22:11:21.4183710Z The following packages will be upgraded:
2019-07-13T22:11:21.6879059Z 1 upgraded, 115 newly installed, 0 to remove and 4 not upgraded.
2019-07-13T22:11:21.6879478Z Need to get 121 MB of archives.
2019-07-13T22:11:21.6879578Z After this operation, 592 MB of additional disk space will be used.
2019-07-13T22:11:21.6880395Z Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgdbm3 amd64 1.8.3-13.1 [16.9 kB]
---
2019-07-13T22:11:22.7587835Z Get:61 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 sudo amd64 1.8.16-0ubuntu1.7 [390 kB]
2019-07-13T22:11:22.7693737Z Get:62 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssl amd64 1.0.2g-1ubuntu4.15 [492 kB]
2019-07-13T22:11:22.7760914Z Get:63 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 ca-certificates all 20170717~16.04.2 [167 kB]
2019-07-13T22:11:22.7785963Z Get:64 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcurl3-gnutls amd64 7.47.0-1ubuntu2.13 [184 kB]
2019-07-13T22:11:22.7815012Z Get:65 http://archive.ubuntu.com/ubuntu xenial/main amd64 libedit2 amd64 3.1-20150325-1ubuntu2 [76.5 kB]
2019-07-13T22:11:22.7996493Z Get:66 http://archive.ubuntu.com/ubuntu xenial/main amd64 libpipeline1 amd64 1.4.1-2 [24.6 kB]
2019-07-13T22:11:22.8005982Z Get:67 http://archive.ubuntu.com/ubuntu xenial/main amd64 binfmt-support amd64 2.1.6-1 [50.7 kB]
2019-07-13T22:11:22.8392458Z Get:69 http://archive.ubuntu.com/ubuntu xenial/main amd64 libisl15 amd64 0.16.1-1 [524 kB]
2019-07-13T22:11:22.8466452Z Get:70 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 cpp-5 amd64 5.4.0-6ubuntu1~16.04.11 [7660 kB]
2019-07-13T22:11:22.9704697Z Get:71 http://archive.ubuntu.com/ubuntu xenial/main amd64 cpp amd64 4:5.3.1-1ubuntu1 [27.7 kB]
2019-07-13T22:11:22.9706186Z Get:72 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 curl amd64 7.47.0-1ubuntu2.13 [139 kB]
---
2019-07-13T22:11:41.0663056Z Unpacking ca-certificates (20170717~16.04.2) ...
2019-07-13T22:11:41.2453606Z Selecting previously unselected package libcurl3-gnutls:amd64.
2019-07-13T22:11:41.2472139Z Preparing to unpack .../libcurl3-gnutls_7.47.0-1ubuntu2.13_amd64.deb ...
2019-07-13T22:11:41.2609437Z Unpacking libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.13) ...
2019-07-13T22:11:41.4269840Z Selecting previously unselected package libedit2:amd64.
2019-07-13T22:11:41.4288795Z Preparing to unpack .../libedit2_3.1-20150325-1ubuntu2_amd64.deb ...
2019-07-13T22:11:41.4468939Z Unpacking libedit2:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-13T22:11:41.5700430Z Selecting previously unselected package libpipeline1:amd64.
2019-07-13T22:11:41.5716197Z Preparing to unpack .../libpipeline1_1.4.1-2_amd64.deb ...
2019-07-13T22:11:41.5903686Z Unpacking libpipeline1:amd64 (1.4.1-2) ...
2019-07-13T22:11:41.7182498Z Selecting previously unselected package binfmt-support.
2019-07-13T22:11:41.7198103Z Preparing to unpack .../binfmt-support_2.1.6-1_amd64.deb ...
2019-07-13T22:11:41.7347970Z Unpacking binfmt-support (2.1.6-1) ...
2019-07-13T22:11:41.8911079Z Preparing to unpack .../binutils_2.26.1-1ubuntu1~16.04.8_amd64.deb ...
2019-07-13T22:11:41.9170386Z Unpacking binutils (2.26.1-1ubuntu1~16.04.8) ...
2019-07-13T22:11:42.3998076Z Selecting previously unselected package libisl15:amd64.
2019-07-13T22:11:42.4012361Z Preparing to unpack .../libisl15_0.16.1-1_amd64.deb ...
---
2019-07-13T22:11:54.1420423Z Selecting previously unselected package libtinfo-dev:amd64.
2019-07-13T22:11:54.1441084Z Preparing to unpack .../libtinfo-dev_6.0+20160213-1ubuntu1_amd64.deb ...
2019-07-13T22:11:54.1571956Z Unpacking libtinfo-dev:amd64 (6.0+20160213-1ubuntu1) ...
2019-07-13T22:11:54.2516281Z Selecting previously unselected package libedit-dev:amd64.
2019-07-13T22:11:54.2536642Z Preparing to unpack .../libedit-dev_3.1-20150325-1ubuntu2_amd64.deb ...
2019-07-13T22:11:54.2654035Z Unpacking libedit-dev:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-13T22:11:54.3750619Z Selecting previously unselected package libllvm6.0:amd64.
2019-07-13T22:11:54.3767043Z Preparing to unpack .../libllvm6.0_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-13T22:11:54.3891005Z Unpacking libllvm6.0:amd64 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:11:57.3295820Z Selecting previously unselected package zlib1g-dev:amd64.
2019-07-13T22:11:57.3315018Z Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2ubuntu4.1_amd64.deb ...
2019-07-13T22:11:57.3439455Z Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
2019-07-13T22:11:57.4437271Z Preparing to unpack .../libssl-dev_1.0.2g-1ubuntu4.15_amd64.deb ...
2019-07-13T22:11:57.4560033Z Unpacking libssl-dev:amd64 (1.0.2g-1ubuntu4.15) ...
2019-07-13T22:11:57.7713213Z Selecting previously unselected package llvm-6.0-runtime.
2019-07-13T22:11:57.7713213Z Selecting previously unselected package llvm-6.0-runtime.
2019-07-13T22:11:57.7732590Z Preparing to unpack .../llvm-6.0-runtime_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-13T22:11:57.7857778Z Unpacking llvm-6.0-runtime (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:11:57.9020518Z Selecting previously unselected package llvm-6.0.
2019-07-13T22:11:57.9045688Z Preparing to unpack .../llvm-6.0_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-13T22:11:57.9172344Z Unpacking llvm-6.0 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:11:58.5679324Z Selecting previously unselected package libffi-dev:amd64.
2019-07-13T22:11:58.5700035Z Preparing to unpack .../libffi-dev_3.2.1-4_amd64.deb ...
2019-07-13T22:11:58.5829931Z Unpacking libffi-dev:amd64 (3.2.1-4) ...
2019-07-13T22:11:58.7019347Z Selecting previously unselected package llvm-6.0-dev.
2019-07-13T22:11:58.7038241Z Preparing to unpack .../llvm-6.0-dev_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-13T22:11:58.7158991Z Unpacking llvm-6.0-dev (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:03.4657645Z Selecting previously unselected package llvm-6.0-tools.
2019-07-13T22:12:03.4682236Z Preparing to unpack .../llvm-6.0-tools_1%3a6.0-1ubuntu2~16.04.1_amd64.deb ...
2019-07-13T22:12:03.4803201Z Unpacking llvm-6.0-tools (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:03.6391467Z Selecting previously unselected package pkg-config.
2019-07-13T22:12:03.6413866Z Preparing to unpack .../pkg-config_0.29.1-0ubuntu1_amd64.deb ...
2019-07-13T22:12:03.6543183Z Unpacking pkg-config (0.29.1-0ubuntu1) ...
2019-07-13T22:12:03.7697029Z Processing triggers for systemd (229-4ubuntu21.21) ...
2019-07-13T22:12:04.1115931Z Setting up libgdbm3:amd64 (1.8.3-13.1) ...
2019-07-13T22:12:04.1804514Z Setting up libffi6:amd64 (3.2.1-4) ...
2019-07-13T22:12:04.2205013Z Setting up libglib2.0-0:amd64 (2.48.2-0ubuntu4.3) ...
---
2019-07-13T22:12:07.7788833Z debconf: unable to initialize frontend: Dialog
2019-07-13T22:12:07.7789609Z debconf: (TERM is not set, so the dialog frontend is not usable.)
2019-07-13T22:12:07.7789934Z debconf: falling back to frontend: Readline
2019-07-13T22:12:08.2704470Z Setting up libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.13) ...
2019-07-13T22:12:08.3120245Z Setting up libedit2:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-13T22:12:08.3489554Z Setting up libpipeline1:amd64 (1.4.1-2) ...
2019-07-13T22:12:08.3870274Z Setting up binfmt-support (2.1.6-1) ...
2019-07-13T22:12:08.4584991Z mount: permission denied
2019-07-13T22:12:08.4587088Z update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
2019-07-13T22:12:08.4612761Z mount: permission denied
2019-07-13T22:12:08.4615521Z update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
2019-07-13T22:12:08.6139564Z invoke-rc.d: could not determine current runlevel
2019-07-13T22:12:08.6170306Z invoke-rc.d: policy-rc.d denied execution of start.
2019-07-13T22:12:08.6760867Z Setting up libisl15:amd64 (0.16.1-1) ...
2019-07-13T22:12:08.7176076Z Setting up cpp-5 (5.4.0-6ubuntu1~16.04.11) ...
2019-07-13T22:12:08.7564799Z Setting up cpp (4:5.3.1-1ubuntu1) ...
2019-07-13T22:12:08.8027658Z Setting up curl (7.47.0-1ubuntu2.13) ...
---
2019-07-13T22:12:10.3732182Z Setting up libedit-dev:amd64 (3.1-20150325-1ubuntu2) ...
2019-07-13T22:12:10.4114328Z Setting up libllvm6.0:amd64 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:10.4551423Z Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
2019-07-13T22:12:10.4976320Z Setting up libssl-dev:amd64 (1.0.2g-1ubuntu4.15) ...
2019-07-13T22:12:10.5412059Z Setting up llvm-6.0-runtime (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:10.5749972Z mount: permission denied
2019-07-13T22:12:10.5754984Z update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
2019-07-13T22:12:10.5913423Z Setting up llvm-6.0 (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:10.6294124Z Setting up libffi-dev:amd64 (3.2.1-4) ...
2019-07-13T22:12:10.6716566Z Setting up llvm-6.0-dev (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:10.7083793Z Setting up llvm-6.0-tools (1:6.0-1ubuntu2~16.04.1) ...
2019-07-13T22:12:10.7444533Z Setting up pkg-config (0.29.1-0ubuntu1) ...
2019-07-13T22:12:10.8713038Z Processing triggers for ca-certificates (20170717~16.04.2) ...
2019-07-13T22:12:10.8878120Z Updating certificates in /etc/ssl/certs...
2019-07-13T22:12:12.4495092Z 148 added, 0 removed; done.
2019-07-13T22:12:12.4496533Z Running hooks in /etc/ca-certificates/update.d...
---
2019-07-13T22:12:45.7879772Z  ---> 4728fd4f5d53
2019-07-13T22:12:45.7919493Z Successfully built 4728fd4f5d53
2019-07-13T22:12:45.9036373Z Successfully tagged rust-ci:latest
2019-07-13T22:12:45.9991258Z Built container sha256:4728fd4f5d537b6f00bf1be59bbab8248b0eb0a43c31f8df5f67136654c9a222
2019-07-13T22:12:46.0013852Z Uploading finished image to https://.s3.amazonaws.com/docker/c7688a42c3598c0b7dfe0f9f69838f24b25841ef6f7f87b4686f4da367d970f5a477b9c1277bdc58ebfc14a49c51c0e2ddb2b3366d867d7aae1de3d9233c8624
2019-07-13T22:13:47.7499558Z upload failed: - to s3:///docker/c7688a42c3598c0b7dfe0f9f69838f24b25841ef6f7f87b4686f4da367d970f5a477b9c1277bdc58ebfc14a49c51c0e2ddb2b3366d867d7aae1de3d9233c8624 Parameter validation failed:
2019-07-13T22:13:47.7500026Z Invalid bucket name "": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$"
2019-07-13T22:13:48.6928945Z [CI_JOB_NAME=x86_64-gnu-llvm-6.0]
2019-07-13T22:13:48.6981306Z Starting sccache server...
2019-07-13T22:13:48.7499216Z configure: processing command line
2019-07-13T22:13:48.7500121Z configure: 
---
2019-07-13T22:17:23.7422953Z    Compiling serde_json v1.0.33
2019-07-13T22:17:28.0766744Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-07-13T22:17:37.0072161Z     Finished release [optimized] target(s) in 1m 32s
2019-07-13T22:17:37.0145506Z tidy check
2019-07-13T22:17:37.2876711Z tidy error: /checkout/src/librustc_mir/dataflow/impls/use_def_chain.rs:252: line longer than 100 chars
2019-07-13T22:17:38.9181962Z some tidy checks failed
2019-07-13T22:17:38.9183049Z 
2019-07-13T22:17:38.9183049Z 
2019-07-13T22:17:38.9184176Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-07-13T22:17:38.9188022Z 
2019-07-13T22:17:38.9188142Z 
2019-07-13T22:17:38.9199982Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-07-13T22:17:38.9200239Z Build completed unsuccessfully in 0:01:35
2019-07-13T22:17:38.9200239Z Build completed unsuccessfully in 0:01:35
2019-07-13T22:17:40.1437334Z ##[error]Bash exited with code '1'.
2019-07-13T22:17:40.1470207Z ##[section]Starting: Checkout
2019-07-13T22:17:40.1471835Z ==============================================================================
2019-07-13T22:17:40.1471904Z Task         : Get sources
2019-07-13T22:17:40.1471947Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Jul 14, 2019

Okay, I think this is ready to be reviewed now. I'll stop rebasing for the time being.

I don't agree that ReachingDefinitions and UseDefChain need to be renamed. Reaching definitions is often the canonical example of a data-flow analysis. The ReachingDefinitions in this PR extends the textbook analysis to work in the presence of projections (e.g. *p = 0 or x.f[1] = 0) but is otherwise the same. Absent existing terminology, "Reaching writes" may be a better name as "definition" is not used anywhere else in the MIR, but there are also definitions which are not writes (e.g. initial values of function parameters and explicitly uninitialized variables). I did not abbreviate "Definitions" to remain consistent with the other dataflow analyses in this module which have names like MaybeInitializedPlaces and HaveBeenBorrowedLocals.

A use-def chain is a graph-like data structure that can be built on top of a reaching definitions analysis. It is not a data-flow analysis itself. In the following example, definitions (2), (3), and (4) reach the final use of x according to a reaching definitions analysis since it cannot know the target of p and must not kill it in case it points to a different variable. However, a use-def chain is interested only in definitions of a given local, so when it sees definition (4), it knows that definition (3) can no longer reach x. The new docs also contain a discussion of the difference between a completed reaching definitions analysis and a use-def chain.

let mut x = 0;    // (1)
let p = &mut x;   // (2)
*p = 1;           // (3)
x = 2;            // (4)
x

I'm not aware of any link between use-def chains and SSA form besides the fact that SSA makes a use-def chain trivial to compute since each variable has exactly one definition. It seems perfectly reasonable to have a use-def chain on a non-SSA IR, although the only resources I found supporting this are a wikipedia page and some lecture slides.

@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Jul 14, 2019

A use-def chain can be used for constant propagation (I mistakenly said the opposite in a zulip chat).

let x = 5;
let mut y = x;

if condition {
     y = 5;
}

The use-def chain for y at the end of the preceding example looks like this:

  x - 5
 /
y - 5

We can traverse the def-use chain (the transpose graph of the use-def chain) beginning from each definition, remembering the right-hand side of that definition as a prospective value for each variable. If we encounter a variable which already has a prospective value which is indeterminate (e.g. a function parameter or non-const function call) or a constant with a different value, we know that we cannot do constant propagation to that variable. Once we have iterated the def-use chain from every definition, constant propagation can be performed on all variables which have exactly one prospective definition.

This seems less efficient than doing a separate dataflow analysis with a lattice specifically intended for constant propagation such as the following (although I'm not sure if that particular algorithm is the best way to achieve this on use-def chains). However there are performance benefits to using bit vectors to do dataflow, and the use-def chain can be shared across multiple compiler passes, whereas a custom dataflow analysis needs to be run from scratch each time.

           ⊤
      /  / | \ \
... -2 -1  0  1 2  ...
      \  \ | / /
           ⊥


pub struct DefVisitor<F>(pub F);

impl<'tcx, F> Visitor<'tcx> for DefVisitor<F>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about the correctness and efficiency of DefVisitor and UseVisitor. Is this a good approach? For DefVisitor at least, we only have to visit the left-hand side of any StatementKind::Assign.

type LocationMap<T> = FxHashMap<Location, T>;
type DefsForLocalDense = IndexVec<Local, BitSet<DefIndex>>;
type DefsForLocalSparse = BTreeMap<Local, BitSet<DefIndex>>;
type DefsForUseAtLocation = LocationMap<DefsForLocalSparse>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once there's a pass that uses a UseDefChain, these data structures should be tweaked for efficiency. I think that DefsForLocalDense should be a BitMatrix and that some uses of BitSet can be changed to HybridBitSets.

/// It's expensive to clone the entry set at the start of each block for every local and apply
/// the appropriate mask. However, we only need to keep `curr_defs_for_local` up-to-date for
/// the `Local`s which are actually used in a given `BasicBlock`.
locals_used_in_block: LocalsUsedInBlock,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a holdover from a previous version of this PR when all_defs_for_local was not cached. It may be faster not to iterate over the mir::Body to initialize locals_used_in_block.

@ecstatic-morse ecstatic-morse marked this pull request as ready for review July 14, 2019 23:45
@ecstatic-morse
Copy link
Contributor Author

I have some concerns about performance and test coverage, but I think this in a decent place overall. I'm removing the draft status.

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-02T17:22:29.5942539Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-02T17:22:29.6154107Z ##[command]git config gc.auto 0
2019-08-02T17:22:29.6235094Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-02T17:22:29.6300155Z ##[command]git config --get-all http.proxy
2019-08-02T17:22:29.6439700Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/62547/merge:refs/remotes/pull/62547/merge
---
2019-08-02T17:23:05.1087559Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-02T17:23:05.1087602Z 
2019-08-02T17:23:05.1087805Z   git checkout -b <new-branch-name>
2019-08-02T17:23:05.1087833Z 
2019-08-02T17:23:05.1087897Z HEAD is now at 6989a4267 Merge 3e1d1fb75a4e0830cb3690bf21dc5f1004e9d4f6 into 1df512fcaeaf17639c5d28a3045814d6f7a7db97
2019-08-02T17:23:05.1243660Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-02T17:23:05.1246662Z ==============================================================================
2019-08-02T17:23:05.1246744Z Task         : Bash
2019-08-02T17:23:05.1246792Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-02T17:31:24.2547450Z     Checking rustc_ast_borrowck v0.0.0 (/checkout/src/librustc_ast_borrowck)
2019-08-02T17:31:25.4899217Z     Checking rustc_passes v0.0.0 (/checkout/src/librustc_passes)
2019-08-02T17:31:26.2452945Z     Checking rustc_mir v0.0.0 (/checkout/src/librustc_mir)
2019-08-02T17:31:26.6965462Z     Checking rustc_traits v0.0.0 (/checkout/src/librustc_traits)
2019-08-02T17:31:27.5024206Z error[E0425]: cannot find value `arg_place` in this scope
2019-08-02T17:31:27.5029187Z    --> src/librustc_mir/transform/rustc_peek.rs:213:25
2019-08-02T17:31:27.5029505Z     |
2019-08-02T17:31:27.5029763Z 213 |                     } = arg_place {
2019-08-02T17:31:27.5030133Z 
2019-08-02T17:31:27.9825647Z     Checking rustc_codegen_utils v0.0.0 (/checkout/src/librustc_codegen_utils)
2019-08-02T17:31:28.6088244Z     Checking rustc_plugin v0.0.0 (/checkout/src/librustc_plugin)
2019-08-02T17:31:28.8947320Z     Checking rustc_resolve v0.0.0 (/checkout/src/librustc_resolve)
---
2019-08-02T17:31:36.4200154Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "2" "--release" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
2019-08-02T17:31:36.4200853Z expected success, got: exit code: 101
2019-08-02T17:31:36.4211201Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-02T17:31:36.4211523Z Build completed unsuccessfully in 0:05:40
2019-08-02T17:31:37.6590017Z ##[error]Bash exited with code '1'.
2019-08-02T17:31:37.6675519Z ##[section]Starting: Checkout
2019-08-02T17:31:37.6677174Z ==============================================================================
2019-08-02T17:31:37.6677304Z Task         : Get sources
2019-08-02T17:31:37.6677347Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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 Aug 5, 2019

☔ The latest upstream changes (presumably #59369) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-08T20:36:23.1361140Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-08T20:36:23.1545378Z ##[command]git config gc.auto 0
2019-08-08T20:36:23.1615774Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-08T20:36:23.1677889Z ##[command]git config --get-all http.proxy
2019-08-08T20:36:23.1814961Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/62547/merge:refs/remotes/pull/62547/merge
---
2019-08-08T20:37:01.5752993Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-08T20:37:01.5753025Z 
2019-08-08T20:37:01.5753251Z   git checkout -b <new-branch-name>
2019-08-08T20:37:01.5753282Z 
2019-08-08T20:37:01.5753329Z HEAD is now at 0d22804b7 Merge fe93ca4d10e620566c9a69fbdfdce43282019895 into 2628f579f6246df385acf9203bf2ffb6aedf5ccc
2019-08-08T20:37:01.5913371Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-08T20:37:01.5917219Z ==============================================================================
2019-08-08T20:37:01.5917276Z Task         : Bash
2019-08-08T20:37:01.5917319Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-08T20:45:34.1602113Z     Checking rustc_mir v0.0.0 (/checkout/src/librustc_mir)
2019-08-08T20:45:35.4413413Z error: unused import: `ProjectionElem`
2019-08-08T20:45:35.4413954Z  --> src/librustc_mir/borrow_check/path_utils.rs:5:76
2019-08-08T20:45:35.4414241Z   |
2019-08-08T20:45:35.4419570Z 5 | use rustc::mir::{BasicBlock, BorrowKind, Location, Body, Place, PlaceBase, ProjectionElem};
2019-08-08T20:45:35.4420208Z   |
2019-08-08T20:45:35.4420807Z   = note: `-D unused-imports` implied by `-D warnings`
2019-08-08T20:45:35.4420843Z 
2019-08-08T20:45:37.5866529Z     Checking rustc_traits v0.0.0 (/checkout/src/librustc_traits)
---
2019-08-08T20:45:44.9935950Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "2" "--release" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
2019-08-08T20:45:44.9936577Z expected success, got: exit code: 101
2019-08-08T20:45:44.9944352Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-08T20:45:44.9944736Z Build completed unsuccessfully in 0:05:43
2019-08-08T20:45:46.2131573Z ##[error]Bash exited with code '1'.
2019-08-08T20:45:46.2162316Z ##[section]Starting: Checkout
2019-08-08T20:45:46.2164399Z ==============================================================================
2019-08-08T20:45:46.2164458Z Task         : Get sources
2019-08-08T20:45:46.2164508Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

Its functionality is duplicated in `borrowed_locals.rs` and
`path_utils.rs`
This informs callers that the lifetime of the reference to the
underlying `PlaceBase` is the same as that of the `Place` being iterated
over. This lets callers return a reference to the underlying `PlaceBase`
from the closure passed to `Place::iterate`.
We now use `dataflow::state_for_location` to get the dataflow state
before calls to `rustc_peek`. The original version used a custom
implementation that only looked at assignment statements.
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (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.
2019-08-08T21:13:17.8422697Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-08T21:13:17.8612219Z ##[command]git config gc.auto 0
2019-08-08T21:13:17.8699249Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-08T21:13:17.8766088Z ##[command]git config --get-all http.proxy
2019-08-08T21:13:17.8920462Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/62547/merge:refs/remotes/pull/62547/merge
---
2019-08-08T21:13:53.9270645Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-08T21:13:53.9270678Z 
2019-08-08T21:13:53.9270896Z   git checkout -b <new-branch-name>
2019-08-08T21:13:53.9270925Z 
2019-08-08T21:13:53.9270991Z HEAD is now at cf0b4ce86 Merge 5d5681a30965400cc268b273f76e259d458e05ba into 2d1a551e144335e0d60a637d12f410cf65849876
2019-08-08T21:13:53.9417206Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-08T21:13:53.9421428Z ==============================================================================
2019-08-08T21:13:53.9421493Z Task         : Bash
2019-08-08T21:13:53.9421560Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-08T21:22:15.5885980Z     Checking rustc_passes v0.0.0 (/checkout/src/librustc_passes)
2019-08-08T21:22:16.3187782Z     Checking rustc_codegen_utils v0.0.0 (/checkout/src/librustc_codegen_utils)
2019-08-08T21:22:16.9424819Z     Checking rustc_plugin v0.0.0 (/checkout/src/librustc_plugin)
2019-08-08T21:22:17.2411887Z     Checking rustc_resolve v0.0.0 (/checkout/src/librustc_resolve)
2019-08-08T21:22:19.6860427Z error[E0507]: cannot move out of index of `std::vec::Vec<rustc::mir::Operand<'_>>`
2019-08-08T21:22:19.6868553Z    --> src/librustc_mir/transform/rustc_peek.rs:209:80
2019-08-08T21:22:19.6868828Z     |
2019-08-08T21:22:19.6869171Z 209 |                 if let mir::Operand::Copy(place) | mir::Operand::Move(place) = args[0] {
2019-08-08T21:22:19.6869611Z     |                                           -----                                ^^^^^^^ help: consider borrowing here: `&args[0]`
2019-08-08T21:22:19.6870203Z     |                                           data moved here
2019-08-08T21:22:19.6870203Z     |                                           data moved here
2019-08-08T21:22:19.6870580Z     |                                           move occurs because `place` has type `rustc::mir::Place<'_>`, which does not implement the `Copy` trait
2019-08-08T21:22:19.9273395Z     Checking rustc_privacy v0.0.0 (/checkout/src/librustc_privacy)
2019-08-08T21:22:20.4955333Z     Checking rustc_codegen_ssa v0.0.0 (/checkout/src/librustc_codegen_ssa)
2019-08-08T21:22:22.9472400Z error: aborting due to previous error
2019-08-08T21:22:22.9472506Z 
---
2019-08-08T21:22:25.1201217Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "2" "--release" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
2019-08-08T21:22:25.1202158Z expected success, got: exit code: 101
2019-08-08T21:22:25.1214139Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2019-08-08T21:22:25.1214596Z Build completed unsuccessfully in 0:05:42
2019-08-08T21:22:26.3808428Z ##[error]Bash exited with code '1'.
2019-08-08T21:22:26.3839386Z ##[section]Starting: Checkout
2019-08-08T21:22:26.3840945Z ==============================================================================
2019-08-08T21:22:26.3840993Z Task         : Get sources
2019-08-08T21:22:26.3841035Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

The previous code ignored that `Drop` terminators could execute custom
`Drop` implementations which might mutate the environment. Now we
correctly implement `has_side_effects` and tests that custom `Drop`
impls are recorded as an indirect definition.
This means that calls to `rustc_peek` are no longer indirect definitions
of any locals in the body. Other pure intrinsics (e.g. `transmute`)
could also be added to the list of exceptions.
@wirelessringo
Copy link

Ping from triage. @ecstatic-morse any updates on this? Thanks.

@bors
Copy link
Contributor

bors commented Aug 16, 2019

☔ The latest upstream changes (presumably #63640) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon
Copy link
Member

Hello from triage!
@ecstatic-morse Can you please fix the conflict in this PR and post your status on it?
cc: @eddyb @bjorn3

Thank you!

@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Aug 24, 2019

This won't get used in the final version of dataflow-based const qualification, and no one from the MIR optimization team has a use case for it, so I'll close this for now.

Centril added a commit to Centril/rust that referenced this pull request Sep 18, 2019
…oli-obk

A more generic interface for dataflow analysis

rust-lang#64470 requires a transfer function that is slightly more complex than the typical `gen`/`kill` one. Namely, it must copy state bits between locals when assignments occur (see rust-lang#62547 for an attempt to make this fit into the existing framework). This PR contains a dataflow interface that allows for arbitrary transfer functions. The trade-off is efficiency: we can no longer coalesce transfer functions for blocks and must visit each statement individually while iterating to fixpoint.

Another issue is that poorly behaved transfer functions can result in an analysis that fails to converge. `gen`/`kill` sets do not have this problem. I believe that, in order to guarantee convergence, flipping a bit from `false` to `true` in the entry set cannot cause an output bit to go from `true` to `false` (negate all preceding booleans when `true` is the bottom value). Perhaps someone with a more formal background can confirm and we can add a section to the docs?

This approach is not maximally generic: it still requires that the lattice used for analysis is the powerset of values of `Analysis::Idx` for the `mir::Body` of interest. This can be done at a later date. Also, this is the bare minimum to get rust-lang#64470 working. I've not adapted the existing debug framework to work with the new analysis, so there are no `rustc_peek` tests either. I'm planning to do this after rust-lang#64470 is merged.

Finally, my ultimate plan is to make the existing, `gen`/`kill`-based `BitDenotation` a special case of `generic::Analysis`. Currently they share a ton of code. I should be able to do this without changing any implementers of `BitDenotation`. Something like:

```rust
struct GenKillAnalysis<A: BitDenotation> {
    trans_for_block: IndexVec<BasicBlock, GenKillSet<A::Idx>>,
    analysis: A,
}

impl<A> generic::Analysis for GenKillAnalysis<A> {
    // specializations of `apply_{partial,whole}_block_effect`...
}
```

r? @pnkfelix
Centril added a commit to Centril/rust that referenced this pull request Sep 19, 2019
…oli-obk

A more generic interface for dataflow analysis

rust-lang#64470 requires a transfer function that is slightly more complex than the typical `gen`/`kill` one. Namely, it must copy state bits between locals when assignments occur (see rust-lang#62547 for an attempt to make this fit into the existing framework). This PR contains a dataflow interface that allows for arbitrary transfer functions. The trade-off is efficiency: we can no longer coalesce transfer functions for blocks and must visit each statement individually while iterating to fixpoint.

Another issue is that poorly behaved transfer functions can result in an analysis that fails to converge. `gen`/`kill` sets do not have this problem. I believe that, in order to guarantee convergence, flipping a bit from `false` to `true` in the entry set cannot cause an output bit to go from `true` to `false` (negate all preceding booleans when `true` is the bottom value). Perhaps someone with a more formal background can confirm and we can add a section to the docs?

This approach is not maximally generic: it still requires that the lattice used for analysis is the powerset of values of `Analysis::Idx` for the `mir::Body` of interest. This can be done at a later date. Also, this is the bare minimum to get rust-lang#64470 working. I've not adapted the existing debug framework to work with the new analysis, so there are no `rustc_peek` tests either. I'm planning to do this after rust-lang#64470 is merged.

Finally, my ultimate plan is to make the existing, `gen`/`kill`-based `BitDenotation` a special case of `generic::Analysis`. Currently they share a ton of code. I should be able to do this without changing any implementers of `BitDenotation`. Something like:

```rust
struct GenKillAnalysis<A: BitDenotation> {
    trans_for_block: IndexVec<BasicBlock, GenKillSet<A::Idx>>,
    analysis: A,
}

impl<A> generic::Analysis for GenKillAnalysis<A> {
    // specializations of `apply_{partial,whole}_block_effect`...
}
```

r? @pnkfelix
Centril added a commit to Centril/rust that referenced this pull request Sep 19, 2019
…oli-obk

A more generic interface for dataflow analysis

rust-lang#64470 requires a transfer function that is slightly more complex than the typical `gen`/`kill` one. Namely, it must copy state bits between locals when assignments occur (see rust-lang#62547 for an attempt to make this fit into the existing framework). This PR contains a dataflow interface that allows for arbitrary transfer functions. The trade-off is efficiency: we can no longer coalesce transfer functions for blocks and must visit each statement individually while iterating to fixpoint.

Another issue is that poorly behaved transfer functions can result in an analysis that fails to converge. `gen`/`kill` sets do not have this problem. I believe that, in order to guarantee convergence, flipping a bit from `false` to `true` in the entry set cannot cause an output bit to go from `true` to `false` (negate all preceding booleans when `true` is the bottom value). Perhaps someone with a more formal background can confirm and we can add a section to the docs?

This approach is not maximally generic: it still requires that the lattice used for analysis is the powerset of values of `Analysis::Idx` for the `mir::Body` of interest. This can be done at a later date. Also, this is the bare minimum to get rust-lang#64470 working. I've not adapted the existing debug framework to work with the new analysis, so there are no `rustc_peek` tests either. I'm planning to do this after rust-lang#64470 is merged.

Finally, my ultimate plan is to make the existing, `gen`/`kill`-based `BitDenotation` a special case of `generic::Analysis`. Currently they share a ton of code. I should be able to do this without changing any implementers of `BitDenotation`. Something like:

```rust
struct GenKillAnalysis<A: BitDenotation> {
    trans_for_block: IndexVec<BasicBlock, GenKillSet<A::Idx>>,
    analysis: A,
}

impl<A> generic::Analysis for GenKillAnalysis<A> {
    // specializations of `apply_{partial,whole}_block_effect`...
}
```

r? @pnkfelix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants