Uh oh!
There was an error while loading. Please reload this page.
MIR EndRegion Statements (was MIR dataflow for Borrows) - #39409
Conversation
rust-highfive
commented
Jan 30, 2017
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
pnkfelix
commented
Jan 30, 2017
r? @arielb1 |
eddyb
commented
Jan 30, 2017
So what happened to the plans for keeping this information in a side table? cc @nikomatsakis |
There was a problem hiding this comment.
Doesn’t early exit from the scope (i.e. exit_scope down below) need a similar treatment?
There was a problem hiding this comment.
You're right, I had overlooked that. Will fix.
(I had been hoping to avoid attempting to write unit tests for this, but maybe I need to do so.)
nagisa
commented
Jan 30, 2017
It makes sense to me to keep these inline, even if just because we already keep StorageLiveDead inline. |
bors
commented
Jan 31, 2017
☔ The latest upstream changes (presumably #39230) made this pull request unmergeable. Please resolve the merge conflicts. |
Well, I think I turned sour on this idea because it's hard to keep such a thing 'in sync' if the MIR is changed in any way. It's very fragile. Also, I think these instructions are temporary (once we adopt the NLL strategy, we'll be able to drop them) and there should be relatively few (you only need them for regions that appear in a loan, though I'm not sure if @pnkfelix handles that since I've not read the PR yet). But it is I suppose an option. |
bors
commented
Feb 4, 2017
☔ The latest upstream changes (presumably #39463) made this pull request unmergeable. Please resolve the merge conflicts. |
pnkfelix
commented
Feb 6, 2017
@arielb1 has convinced me that I need to add some code-gen tests, even if their initial state is based solely on eyeballing the output to confirm that it is sane. |
There was a problem hiding this comment.
ah I forgot about that; will fix.
Bisection reports that commit 039f5f95ea6646741f9fdd7d6cb9335366d5c82b injected a bug... investigating update: oh, I see it. This distinguished moves from overwrites. It was also meant to be a refactoring, but it started skipping some important code for the overwrite case. |
c8e3994 to
4928c37Comparepnkfelix
commented
Feb 10, 2017
@arielb1 has suggested that I had a static check that no regions reach mir |
pnkfelix
commented
Feb 13, 2017
(Testing reveals that I missed EndRegion's on the unwind path ... fixing in tandem with adding the above suggested static check.) |
There was a problem hiding this comment.
does -Zverbose not do it for you? Too verbose?
There was a problem hiding this comment.
Yes, -Zverbose is far too verbose, especially when it is embedded within a &<region> <lvalue> borrow-expression.
I don't want or care about the internal structure of the region value for these cases; it is much more convenient to look at the unique id's being generated here (by taking advantage of the fact that one cannot write a lifetime of the form '<number><alphanum>
bors
commented
Feb 18, 2017
☔ The latest upstream changes (presumably #39854) made this pull request unmergeable. Please resolve the merge conflicts. |
bors
commented
Mar 15, 2017
☔ The latest upstream changes (presumably #40383) made this pull request unmergeable. Please resolve the merge conflicts. |
ad6c87e to
42ad606Comparepnkfelix
commented
Jun 13, 2017
Narrowed problem down via |
nikomatsakis
commented
Jun 13, 2017
@pnkfelix nice hunting |
arielb1
commented
Jun 15, 2017
Looks like the bug is fixed by llvm-mirror/llvm@f45bea4. I'll have the fix in my Grand ARM Fix Rollup, which I should really get done Real Soon. |
@arielb1 helped me confirm that the LLVM bug occurs on our fork of LLVM, but not on LLVM's master copy. And I have now confirmed that the nearest common ancestor between the two also exhibits the bug. I am bisecting against the LLVM git history to try to isolate a patch for the bug that we might be able to apply to our fork. Update: Oops, I didn't reload the page so I missed @arielb1's comment. Okay I guess my bisection is not necessary then. |
So ARM had quite a few codegen bugs on LLVM 4.0 which are fixed on LLVM trunk. This backports 5 of them: r297871 - ARM: avoid clobbering register in v6 jump-table expansion. - fixesrust-lang#42248 r294949 - [Thumb-1] TBB generation: spot redefinitions of index r295816 - [ARM] Fix constant islands pass. r300870 - [Thumb-1] Fix corner cases for compressed jump tables r302650 - [IfConversion] Add missing check in IfConversion/canFallThroughTo - unblocks rust-lang#39409
Backport fixes to LLVM 4.0 ARM codegen bugs So ARM had quite a few codegen bugs on LLVM 4.0 which are fixed on LLVM trunk. This backports 5 of them: r297871 - ARM: avoid clobbering register in v6 jump-table expansion. - fixes#42248 r294949 - [Thumb-1] TBB generation: spot redefinitions of index r295816 - [ARM] Fix constant islands pass. r300870 - [Thumb-1] Fix corner cases for compressed jump tables r302650 - [IfConversion] Add missing check in IfConversion/canFallThroughTo - unblocks #39409 r? @alexcrichton beta-nominating because this fixes regressions introduced by LLVM 4.0.
arielb1
commented
Jun 19, 2017
Given that the LLVM bug is fixed: |
bors
commented
Jun 19, 2017
📌 Commit 11f4968 has been approved by |
bors
commented
Jun 19, 2017
MIR EndRegion Statements (was MIR dataflow for Borrows) This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow). An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...) This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
bors
commented
Jun 19, 2017
☀️ Test successful - status-appveyor, status-travis |
So ARM had quite a few codegen bugs on LLVM 4.0 which are fixed on LLVM trunk. This backports 5 of them: r297871 - ARM: avoid clobbering register in v6 jump-table expansion. - fixesrust-lang#42248 r294949 - [Thumb-1] TBB generation: spot redefinitions of index r295816 - [ARM] Fix constant islands pass. r300870 - [Thumb-1] Fix corner cases for compressed jump tables r302650 - [IfConversion] Add missing check in IfConversion/canFallThroughTo - unblocks rust-lang#39409
Fix destruction extent lookup during HIR -> HAIR translation My method for finding the destruction extent, if any, from cbed41a (in rust-lang#39409), was buggy in that it sometimes failed to find an extent that was nonetheless present. This fixes that, and is cleaner code to boot. Fixrust-lang#43457
This PR adds an
EndRegionstatement to MIR (where theEndRegionstatement is what terminates a borrow).An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...)
This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.