[PATCH] D37467: Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 02:36:08 PDT 2017


chandlerc updated this revision to Diff 117643.
chandlerc added a comment.

Rebase (and move to mono-repo layout, sorry for any disruption).

Address the feedback from Danny by rewriting the safety check to work
depth-first (so that we can effectively cache *unsafe* operations rather than
re-exploring them) and preorder (so that we prune early rather than late). Last
but not least, this also allows us to cache safe to speculate sub-regions even
if the whole is not safe, avoidnig reexploring those subregions repeatedly.

I've also added various comments and cleaned up the code a bit to reflect the
more robust design.

I actually took a stab at sharing code between preorder and postorder walks
here, but it made the code substantially harder to read. This is in large part
because the preorder checks are distinctly for *operands* only and thus the
structure ends up surprisingly different.


https://reviews.llvm.org/D37467

Files:
  llvm/include/llvm/Transforms/Scalar/SpeculateAroundPHIs.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/SpeculateAroundPHIs.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Transforms/SpeculateAroundPHIs/X86/basic.ll
  llvm/test/Transforms/SpeculateAroundPHIs/X86/lit.local.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37467.117643.patch
Type: text/x-patch
Size: 54343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171004/93c9db84/attachment.bin>


More information about the llvm-commits mailing list