-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
dataflow: use CFGIndex directly as bitvector index #15019
Comments
(As noted in a comment on #15371, doing this should allow us to get rid of the somewhat ugly frozen/non-frozen distinction in the cfg API.) |
A potential advantage of doing this that I just realized: since the |
it is definitely dense (and maximally so). I had convinced myself earlier that there could be gaps, but that seems to have been incorrect: according to my instrumentation, the |
(and a random thought I had while reflecting on this: if we actually allocated extra NodeIds with each expr type that introduces dummy nodes (at least, I believe there is a statically determinable upper bound on the number of dummy cfg nodes per expr node), then the relation between Expr Node ID and CFGIndex would be a simple offset calculation determined from the NodeId of the block itself. That would save us the time of building up the map that is currently used to represent that relation explicitly.) update: the above idea isn't ridiculous, but it also isn't an obvious win: You still have the problem that the NodeId's are sparse, i.e. that there may be large gaps between different NodeId's associated with the same control flow graph. |
…albasi Fix panic in displaying const trait objects I hope this fixes the panic on recent nightly stdlib, but I didn't test it locally.
One of the artifacts left over from the old dataflow analysis code was that it had a
NodeId
to bitvector index mapping that it maintained, since theNodeId
s in question were often sparse and also could fall into a range far from starting from zero.When @pnkfelix converted the code to use the control-flow-graph abstraction, he switched things so that the
CFGIndex
instead mapped to the relevant bitvector index, and then a different table mappedNodeId
toCFGIndex
.The first aforementioned table is
index_to_bitset
, here: https://github.com/rust-lang/rust/pull/14873/files#diff-158b34791d327b238be103c2d1867e71R48That's fine, except that the assumptions that motivated using a bitvector index distinct from
NodeId
(sparse, and starts from from zero) may not hold forCFGIndex
.More specifically,
CFGIndex
definitely starts from zero. And they are probably very very dense.It would be good to:
CFGIndex
is dense (i.e. gather some quick stats), and thenCFGIndex
directly as the index into the bitvector for dataflow.The text was updated successfully, but these errors were encountered: