[PATCH] [PM] Change the core design of the TTI analysis to use a polymorphic type erased interface and a single analysis pass rather than an extremely complex analysis group.

Chandler Carruth chandlerc at gmail.com
Fri Jan 30 05:36:38 PST 2015


Hi hfinkel, echristo,

The end result is that the TTI analysis can contain a type erased
implementation that supports the polymorphic TTI interface. We can build
one from a target-specific implementation or from a dummy one in the IR.

I've also factored all of the code into "mix-in"-able base classes,
including CRTP base classes to facilitate calling back up to the most
specialized form when delegating horizontally across the surface.

There are a number of reasons for this change, and this particular
design. The first and foremost reason is that an analysis group is
complete overkill, and the chaining delegation strategy was so opaque,
confusing, and high overhead that TTI was suffering greatly for it.
Several of the TTI functions had failed to be implemented in all places
because of the chaining-based delegation making there be no checking of
this. A few other functions were implemented with incorrect delegation.
The message to me was very clear working on this -- the delegation and
analysis group structure was too confusing to be useful here.

The other reason of course is that this is *much* more natural fit for
the new pass manager. This will lay the ground work for a type-erased
per-function info object that can look up the correct subtarget and even
cache it.

Yet another benefit is that this will significantly simplify the
interaction of the pass managers and the TargetMachine. See the future
work below.

There is still a lot more to be done here, but this was the huge chunk
that I couldn't really split things out of because this was the
interface change to TTI. I've tried to minimize all the other parts of
this. The follow up work should include:

1) Improving the TargetMachine interface by having it directly return
   a TTI object. Because we have a non-pass object with value semantics
   and an internal type erasure mechanism, we can narrow the interface
   of the TargetMachine to *just* do what we need: build and return
   a TTI object that we can then insert into the pass pipeline.
2) Make the TTI object be fully specialized for a particular function.
   This will include splitting off a minimal form of it which is
   sufficient for the inliner and the old pass manager.
3) Add a new pass manager analysis which produces TTI objects from the
   target machine for each function.

http://reviews.llvm.org/D7293

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/CodeGen/BasicTTIImpl.h
  include/llvm/InitializePasses.h
  include/llvm/Target/TargetMachine.h
  lib/Analysis/Analysis.cpp
  lib/Analysis/CostModel.cpp
  lib/Analysis/FunctionTargetTransformInfo.cpp
  lib/Analysis/IPA/InlineCost.cpp
  lib/Analysis/TargetTransformInfo.cpp
  lib/CodeGen/BasicTargetTransformInfo.cpp
  lib/CodeGen/CodeGen.cpp
  lib/CodeGen/CodeGenPrepare.cpp
  lib/Target/AArch64/AArch64TargetMachine.cpp
  lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  lib/Target/ARM/ARMTargetMachine.cpp
  lib/Target/ARM/ARMTargetTransformInfo.cpp
  lib/Target/Mips/MipsTargetMachine.cpp
  lib/Target/NVPTX/NVPTXTargetMachine.cpp
  lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
  lib/Target/PowerPC/PPCTargetMachine.cpp
  lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  lib/Target/R600/AMDGPUTargetMachine.cpp
  lib/Target/R600/AMDGPUTargetTransformInfo.cpp
  lib/Target/Target.cpp
  lib/Target/TargetMachine.cpp
  lib/Target/X86/X86TargetMachine.cpp
  lib/Target/X86/X86TargetTransformInfo.cpp
  lib/Target/XCore/XCoreTargetMachine.cpp
  lib/Target/XCore/XCoreTargetTransformInfo.cpp
  lib/Transforms/Scalar/ConstantHoisting.cpp
  lib/Transforms/Scalar/EarlyCSE.cpp
  lib/Transforms/Scalar/IndVarSimplify.cpp
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  lib/Transforms/Scalar/LoopRotation.cpp
  lib/Transforms/Scalar/LoopStrengthReduce.cpp
  lib/Transforms/Scalar/LoopUnrollPass.cpp
  lib/Transforms/Scalar/LoopUnswitch.cpp
  lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
  lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
  lib/Transforms/Scalar/SimplifyCFGPass.cpp
  lib/Transforms/Scalar/TailRecursionElimination.cpp
  lib/Transforms/Vectorize/BBVectorize.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Analysis/CostModel/no_info.ll
  tools/opt/opt.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7293.19034.patch
Type: text/x-patch
Size: 243806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150130/31fc9e27/attachment.bin>


More information about the llvm-commits mailing list