[PATCH] D47893: Add a PhiValuesAnalysis pass to calculate the underlying values of phis

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 10:19:55 PDT 2018


john.brawn updated this revision to Diff 152338.
john.brawn edited the summary of this revision.
john.brawn added a comment.

After a lot of time spent trying to get it to work, I've decided that there's no way to get the analysis to handle all possible ways that the calculated values can be invalidated without ending up with something slower than if you jsut recalculate everything from scratch every time. The problems are:

- Using ValueHandles doesn't work because plenty of passes modify a phi's operands directly and ValueHandle doesn't notice that.
- Using pointers to the Use list of the phi can cope with that, but everything goes wrong if an operand is added to the phi as the use list gets reallocated.
- Just caching the set of phis that a phi depends on and examining all of those to figure out if any have had operands changed works, but it's slower than just traversing the phi from scratch.

So I've ended up with going back to the original idea I had of having an interface to the analysis that lets you explicitly invalidate things, and using it from MemoryDependenceAnalysis where we already get notified about things being invalidated.


https://reviews.llvm.org/D47893

Files:
  include/llvm/Analysis/PhiValues.h
  include/llvm/InitializePasses.h
  lib/Analysis/Analysis.cpp
  lib/Analysis/CMakeLists.txt
  lib/Analysis/PhiValues.cpp
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def
  test/Analysis/PhiValues/basic.ll
  test/Analysis/PhiValues/big_phi.ll
  test/Analysis/PhiValues/long_phi_chain.ll
  unittests/Analysis/CMakeLists.txt
  unittests/Analysis/PhiValuesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47893.152338.patch
Type: text/x-patch
Size: 35344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180621/aa623ce8/attachment.bin>


More information about the llvm-commits mailing list