[PATCH] D72380: [DataFlow] Factor two worklist implementations out

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 15:20:28 PST 2020


xazax.hun added a comment.

In D72380#1822927 <https://reviews.llvm.org/D72380#1822927>, @NoQ wrote:

> The change in uninitialized values analysis gives me a bit of anxiety. Could you explain what exactly has changed that caused the change in the stats and why you think it doesn't make a difference, maybe give an example? (an example could be obtained by `creduce`-ing over "the stats have changed" criterion)


Yeah, this is the riskiest part, so I do understand the concerns. Basically, the former implementation was using `PostOrderCFGView::iterator`s and a stack (popping from the back of a smallvector). When the stack was empty, it popped the next element from the iterator. Also, the analysis queues the successors of a node once it was processed (and the analysis state was changed).
So let's imagine a linear CFG. We will process it multiple times with the original implementation, we traverse the CFG both using DFS and using reverse post order.

The new implementation is only using a reverse post order (no stack, no DFS), and does not have an extra pass over the CFG like the previous one.

Since this is a fixed point iteration and we should stop iterating whenever we reached the fixed point. Reaching that with fewer iterations sounds good to me. Since we always queue the successors of a changed node I have hard time imagining how could we stop prematurely.

I can look into a minimal repro if that helps.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72380/new/

https://reviews.llvm.org/D72380





More information about the cfe-commits mailing list