Questions about `rustc_mir_dataflow` analyses

I am trying to write a backward rustc_mir_dataflow analysis.

Before iterate_to_fixpoint is called, I intentionally remove some edges from the graph (using MirPatch) to prevent data from flowing along those edges.

But this creates a problem, because the rustc code that initializes an analysis's work queue assumes that all blocks are reachable. Because some edges have been removed, not all blocks are reachable.

My questions are:

  1. Is it a "bug" (for lack of a better term) that the work-queue-initialization code assumes all blocks are reachable?
  2. If not, is there some other way to prevent data from flowing along an edge, without removing the edge?

This question about rustc's implementation may be better suited to IRLO. (Leave a note here if you cross-post.)

1 Like

Thanks, @quinedot.

After looking into this further, I convinced myself that it is a "bug" in the API. So I submitted a PR to fix it.

Still, I agree that the internals forum would have been a better place to ask this question. I'll ask similar, future questions there.

Thanks again.

You might also be interested in the #t-compiler/help stream on zulip.

Thanks, @scottmcm. I appreciate the recommendation. :pray:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.