diff options
author | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-08-31 19:26:19 +0000 |
---|---|---|
committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-08-31 19:26:19 +0000 |
commit | e0b2d97b520b381f4002f1028f580defe1a31d9d (patch) | |
tree | ed81bc1bd60b8f571b53dd7c802949b624410b45 /llvm/lib/Analysis/LoopInfo.cpp | |
parent | 8d84605f25d91c63c2c9e2c8f42575da520f17a3 (diff) | |
download | bcm5719-llvm-e0b2d97b520b381f4002f1028f580defe1a31d9d.tar.gz bcm5719-llvm-e0b2d97b520b381f4002f1028f580defe1a31d9d.zip |
[LoopInfo] Add verification by recomputation.
Summary:
Current implementation of LI verifier isn't ideal and fails to detect
some cases when LI is incorrect. For instance, it checks that all
recorded loops are in a correct form, but it has no way to check if
there are no more other (unrecorded in LI) loops in the function. This
patch adds a way to detect such bugs.
Reviewers: chandlerc, sanjoy, hfinkel
Subscribers: llvm-commits, silvas, mzolotukhin
Differential Revision: https://reviews.llvm.org/D23437
llvm-svn: 280280
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 9d2e38e19da..a5f816dd5ad 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -703,8 +703,10 @@ void LoopInfoWrapperPass::verifyAnalysis() const { // -verify-loop-info option can enable this. In order to perform some // checking by default, LoopPass has been taught to call verifyLoop manually // during loop pass sequences. - if (VerifyLoopInfo) - LI.verify(); + if (VerifyLoopInfo) { + auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); + LI.verify(DT); + } } void LoopInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { @@ -719,7 +721,8 @@ void LoopInfoWrapperPass::print(raw_ostream &OS, const Module *) const { PreservedAnalyses LoopVerifierPass::run(Function &F, FunctionAnalysisManager &AM) { LoopInfo &LI = AM.getResult<LoopAnalysis>(F); - LI.verify(); + auto &DT = AM.getResult<DominatorTreeAnalysis>(F); + LI.verify(DT); return PreservedAnalyses::all(); } |