diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 21:17:44 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 21:17:44 +0000 | 
| commit | d8866befb86698415f5ef82446c22f6da5fb2bd9 (patch) | |
| tree | 8e065eeef7bc4f367ca6be6d213b4704a3ba3938 /contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp | |
| parent | 27c240688cf3256100eb4165a75b2981565d9813 (diff) | |
| parent | b5630dbadf9a2a06754194387d6b0fd9962a67f1 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp')
| -rw-r--r-- | contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp | 27 | 
1 files changed, 14 insertions, 13 deletions
diff --git a/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp b/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp index f2e024c5e3bd..3a1a3020a8d4 100644 --- a/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/contrib/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -14,6 +14,7 @@  //===----------------------------------------------------------------------===//  #include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/TargetPassConfig.h"  #include "llvm/ADT/DenseMap.h"  #include "llvm/ADT/SetVector.h"  #include "llvm/ADT/SmallSet.h" @@ -197,10 +198,11 @@ class TypePromotionTransaction;    public:      static char ID; // Pass identification, replacement for typeid -    explicit CodeGenPrepare(const TargetMachine *TM = nullptr) -        : FunctionPass(ID), TM(TM), TLI(nullptr), TTI(nullptr), DL(nullptr) { -        initializeCodeGenPreparePass(*PassRegistry::getPassRegistry()); -      } +    CodeGenPrepare() +        : FunctionPass(ID), TM(nullptr), TLI(nullptr), TTI(nullptr), +          DL(nullptr) { +      initializeCodeGenPreparePass(*PassRegistry::getPassRegistry()); +    }      bool runOnFunction(Function &F) override;      StringRef getPassName() const override { return "CodeGen Prepare"; } @@ -255,15 +257,13 @@ class TypePromotionTransaction;  }  char CodeGenPrepare::ID = 0; -INITIALIZE_TM_PASS_BEGIN(CodeGenPrepare, "codegenprepare", -                         "Optimize for code generation", false, false) +INITIALIZE_PASS_BEGIN(CodeGenPrepare, "codegenprepare", +                      "Optimize for code generation", false, false)  INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass) -INITIALIZE_TM_PASS_END(CodeGenPrepare, "codegenprepare", -                       "Optimize for code generation", false, false) +INITIALIZE_PASS_END(CodeGenPrepare, "codegenprepare", +                    "Optimize for code generation", false, false) -FunctionPass *llvm::createCodeGenPreparePass(const TargetMachine *TM) { -  return new CodeGenPrepare(TM); -} +FunctionPass *llvm::createCodeGenPreparePass() { return new CodeGenPrepare(); }  bool CodeGenPrepare::runOnFunction(Function &F) {    if (skipFunction(F)) @@ -279,7 +279,8 @@ bool CodeGenPrepare::runOnFunction(Function &F) {    BPI.reset();    ModifiedDT = false; -  if (TM) { +  if (auto *TPC = getAnalysisIfAvailable<TargetPassConfig>()) { +    TM = &TPC->getTM<TargetMachine>();      SubtargetInfo = TM->getSubtargetImpl(F);      TLI = SubtargetInfo->getTargetLowering();      TRI = SubtargetInfo->getRegisterInfo(); @@ -349,7 +350,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {      // Really free removed instructions during promotion.      for (Instruction *I : RemovedInsts) -      delete I; +      I->deleteValue();      EverMadeChange |= MadeChange;    }  | 
