OSDN Git Service

[LazyMachineBFI] Reimplement with getAnalysisIfAvailable
authorAdam Nemet <anemet@apple.com>
Thu, 23 Feb 2017 17:30:01 +0000 (17:30 +0000)
committerAdam Nemet <anemet@apple.com>
Thu, 23 Feb 2017 17:30:01 +0000 (17:30 +0000)
commite73243639ab291d8d532b1aca22d677990184586
tree35586bb01e579ed8a95f14b28ae067d9b769ecbf
parentc5d447ad7744016b65c8aec0358879080a7cf6ef
[LazyMachineBFI] Reimplement with getAnalysisIfAvailable

Since LoopInfo is not available in machine passes as universally as in IR
passes, using the same approach for OptimizationRemarkEmitter as we did for IR
will run LoopInfo and DominatorTree unnecessarily.  (LoopInfo is not used
lazily by ORE.)

To fix this, I am modifying the approach I took in D29836.  LazyMachineBFI now
uses its client passes including MachineBFI itself that are available or
otherwise compute them on the fly.

So for example GreedyRegAlloc, since it's already using MBFI, will reuse that
instance.  On the other hand, AsmPrinter in Justin's patch will generate DT,
LI and finally BFI on the fly.

(I am of course wondering now if the simplicity of this approach is even
preferable in IR.  I will do some experiments.)

Testing is provided by an updated version of D29837 which requires Justin's
patch to bring ORE to the AsmPrinter.

Differential Revision: https://reviews.llvm.org/D30128

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295996 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/LazyMachineBlockFrequencyInfo.h
lib/CodeGen/LazyMachineBlockFrequencyInfo.cpp
lib/CodeGen/MachineOptimizationRemarkEmitter.cpp