[PATCH] D71692: [WIP] Prototype outlined assumptions and operand bundle information attachment

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 01:15:42 PST 2019


jdoerfert created this revision.
jdoerfert added reviewers: hfinkel, xbolva00, lebedev.ri, nikic, Tyker, rjmccall, spatel.
Herald added subscribers: dang, dexonsmith, steven_wu, bollu, hiraditya, mgorny, mehdi_amini.
Herald added a project: LLVM.

NOTE: This is a prototype not a finished patch!

This patch introduces an assumption outliner, which is probably not here to
stay but helpful in creating operand bundle annotated llvm.assumes and
outlined assumption code.

Various passes, basically all that seemed interesting and deal with
assumptions, have been updated to work with outlined assumption code to
some degree.

AlignmentFromAssumptions is used to provide an additional operand bundle
for the llvm.assume that connects the outlined code with its original
location. The operand bundle has the form

  `"align"(%ptr, %alignment, %offset)`

and that is the form we should generate in the first place.
The AlignmentFromAssumptionsPass is also able to read "align" operand
bundles on llvm.assume calls.

The other passes that deal with the outlined assumptions do violate
function pass rules but it should be sufficient to test this out.

Test for a few affected passes have been modified to run the outliner
first. While there are problems, overall most transformations are sill
possible and performed already.

A path forward could be to adopt (a clean version of) the outliner for
now but only run it if we can encode the information "natively" in an
operand bundle, e.g., as described for "align" above. We then would
start to emit information in this format in the frontends and decide how
we want to deal with outlining.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71692

Files:
  llvm/include/llvm/Analysis/AssumptionCache.h
  llvm/include/llvm/InitializePasses.h
  llvm/lib/Analysis/AssumptionCache.cpp
  llvm/lib/Analysis/LazyValueInfo.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/LTO/LTOCodeGenerator.cpp
  llvm/lib/Transforms/IPO/AssumptionOutliner.cpp
  llvm/lib/Transforms/IPO/CMakeLists.txt
  llvm/lib/Transforms/IPO/IPO.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/AlignmentFromAssumptions/simple.ll
  llvm/test/Transforms/AlignmentFromAssumptions/simple32.ll
  llvm/test/Transforms/GVN/assume-equal.ll
  llvm/test/Transforms/InstCombine/assume.ll
  llvm/test/Transforms/InstSimplify/assume.ll
  llvm/test/Transforms/JumpThreading/assume-edge-dom.ll
  llvm/test/Transforms/JumpThreading/assume.ll
  llvm/test/Transforms/JumpThreading/pr33917.ll
  llvm/test/Transforms/JumpThreading/pr36133.ll
  llvm/test/Transforms/LoopVectorize/X86/assume.ll
  llvm/test/Transforms/NewGVN/assumes.ll
  llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
  llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71692.234675.patch
Type: text/x-patch
Size: 39723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191219/e0fcc003/attachment.bin>


More information about the llvm-commits mailing list