[PATCH] D70044: [LVI] Make results independent of query order (WIP)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 9 06:15:33 PST 2019


nikic created this revision.
nikic added reviewers: reames, lebedev.ri.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Related to D69686 <https://reviews.llvm.org/D69686>. Previously LVI broke cycles as they occurred, by assuming an overdefined result if pushBlockValue() failed. This means that the result depends on the query order, as this may start (and correspondingly break) the cycle at different points.

This patch proposes to instead break cycles at back-edges, so that the results computed by LVI are fixed by the control flow structure and do not depend on query order. We assume that the block value coming from the backedge is overdefined and only use any potential edge-local value in that case. This gives LVI a well-defined acyclic dependency graph.

This is a prototype implementation to get some feedback. The main problem is that right now, I'm aggressively clearing the backedge cache if any CFG change occurs. This might be expensive and it would be better to do more fine-grained updates. Not sure how hard that would be.

Another unfortunate bit is that we still need to check for cycles in pushBlockValue(), due to the degenerate case of unreachable basic blocks, which may contain self-referencing instructions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70044

Files:
  llvm/lib/Analysis/LazyValueInfo.cpp
  llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70044.228570.patch
Type: text/x-patch
Size: 7185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191109/dc9b1e8e/attachment.bin>


More information about the llvm-commits mailing list