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

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 17:59:59 PST 2020


xazax.hun created this revision.
xazax.hun added reviewers: gribozavr2, NoQ, Szelethus, rsmith.
xazax.hun added a project: clang.
Herald added subscribers: Charusso, gamesh411, dkrupp, rnkovacs.

In Clang, we have the tendency to have ad-hoc worklist implementations everywhere. This patch is a first attempt to try to make two of them reusable. 
In case the flow-sensitive lifetime analysis gets upstreamed, it is also likely to use the FordwardDataflowWorklist type (it is already using something very similar). 
This could also be useful for future dataflow algorithms.

The UninitializedValues analysis used to do something slightly different which should functionally equivalent with the new implementation but might be slightly more efficient. To tell the truth, I did not measure the performance implications yet. 
Originally, it did not enqueue the whole CFG to initially populate the worklist. It maintained an iterator instead, and initially, the blocks were popped from the iterator instead of the queue.

Do we have a good benchmark to measure the differences? In case this code happens to be performance critical I could try to do some similar optimizations to the new version.

What do you think, is this something we should pursue?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72380

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowValues.h
  clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
  clang/lib/Analysis/LiveVariables.cpp
  clang/lib/Analysis/UninitializedValues.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72380.236728.patch
Type: text/x-patch
Size: 9415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200108/101d3e4e/attachment-0001.bin>


More information about the cfe-commits mailing list