diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-01-02 09:26:36 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-01-02 09:26:36 +0000 |
commit | dbdc9c274d05e87ed342ea1d1076c569b3de7f62 (patch) | |
tree | e6d0e713fe439cb4a001656383ce2e3a2bef29de /llvm/lib/CodeGen/WinEHPrepare.cpp | |
parent | 30f9bfd57490e37852010ddc5363f72d89efc33f (diff) | |
download | bcm5719-llvm-dbdc9c274d05e87ed342ea1d1076c569b3de7f62.tar.gz bcm5719-llvm-dbdc9c274d05e87ed342ea1d1076c569b3de7f62.zip |
[WinEH] Add additional verification
Recolor the IR to make sure our computed colors are not hiding any bugs.
Also, verifyFunction if we are running some post-preparation operations;
some of these operations can hide latent bugs.
llvm-svn: 256687
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 52fb922c935..83507894b49 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -22,6 +22,7 @@ #include "llvm/Analysis/EHPersonalities.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/WinEHFuncInfo.h" +#include "llvm/IR/Verifier.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" @@ -864,7 +865,6 @@ void WinEHPrepare::cleanupPreparedFunclets(Function &F) { } void WinEHPrepare::verifyPreparedFunclets(Function &F) { - // Recolor the CFG to verify that all is well. for (BasicBlock &BB : F) { size_t NumColors = BlockColors[&BB].size(); assert(NumColors == 1 && "Expected monochromatic BB!"); @@ -875,8 +875,6 @@ void WinEHPrepare::verifyPreparedFunclets(Function &F) { if (!DisableDemotion) { bool EHPadHasPHI = BB.isEHPad() && isa<PHINode>(BB.begin()); assert(!EHPadHasPHI && "EH Pad still has a PHI!"); - if (EHPadHasPHI) - report_fatal_error("EH Pad still has a PHI!"); } } } @@ -896,12 +894,17 @@ bool WinEHPrepare::prepareExplicitEH(Function &F) { demotePHIsOnFunclets(F); if (!DisableCleanups) { + DEBUG(verifyFunction(F)); removeImplausibleInstructions(F); + DEBUG(verifyFunction(F)); cleanupPreparedFunclets(F); } - verifyPreparedFunclets(F); + DEBUG(verifyPreparedFunclets(F)); + // Recolor the CFG to verify that all is well. + DEBUG(colorFunclets(F)); + DEBUG(verifyPreparedFunclets(F)); BlockColors.clear(); FuncletBlocks.clear(); |