diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 | 
| commit | eb11fae6d08f479c0799db45860a98af528fa6e7 (patch) | |
| tree | 44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/CodeGen/ResetMachineFunctionPass.cpp | |
| parent | b8a2042aa938069e862750553db0e4d82d25822c (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/ResetMachineFunctionPass.cpp')
| -rw-r--r-- | lib/CodeGen/ResetMachineFunctionPass.cpp | 18 | 
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/CodeGen/ResetMachineFunctionPass.cpp b/lib/CodeGen/ResetMachineFunctionPass.cpp index f1885aa74285..a02302e6ff99 100644 --- a/lib/CodeGen/ResetMachineFunctionPass.cpp +++ b/lib/CodeGen/ResetMachineFunctionPass.cpp @@ -13,9 +13,12 @@  /// happen is that the MachineFunction has the FailedISel property.  //===----------------------------------------------------------------------===// +#include "llvm/ADT/ScopeExit.h"  #include "llvm/ADT/Statistic.h"  #include "llvm/CodeGen/MachineFunction.h"  #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/StackProtector.h"  #include "llvm/CodeGen/Passes.h"  #include "llvm/IR/DiagnosticInfo.h"  #include "llvm/Support/Debug.h" @@ -42,12 +45,23 @@ namespace {      StringRef getPassName() const override { return "ResetMachineFunction"; } +    void getAnalysisUsage(AnalysisUsage &AU) const override { +      AU.addPreserved<StackProtector>(); +      MachineFunctionPass::getAnalysisUsage(AU); +    } +      bool runOnMachineFunction(MachineFunction &MF) override { +      // No matter what happened, whether we successfully selected the function +      // or not, nothing is going to use the vreg types after us. Make sure they +      // disappear. +      auto ClearVRegTypesOnReturn = +          make_scope_exit([&MF]() { MF.getRegInfo().clearVirtRegTypes(); }); +        if (MF.getProperties().hasProperty(                MachineFunctionProperties::Property::FailedISel)) {          if (AbortOnFailedISel)            report_fatal_error("Instruction selection failed"); -        DEBUG(dbgs() << "Reseting: " << MF.getName() << '\n'); +        LLVM_DEBUG(dbgs() << "Resetting: " << MF.getName() << '\n');          ++NumFunctionsReset;          MF.reset();          if (EmitFallbackDiag) { @@ -65,7 +79,7 @@ namespace {  char ResetMachineFunction::ID = 0;  INITIALIZE_PASS(ResetMachineFunction, DEBUG_TYPE, -                "reset machine function if ISel failed", false, false) +                "Reset machine function if ISel failed", false, false)  MachineFunctionPass *  llvm::createResetMachineFunctionPass(bool EmitFallbackDiag = false,  | 
