summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/IslCodeGeneration.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-02-27 17:37:05 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-02-27 17:37:05 +0000
commit0b169c0cab663b8708d30e37bebe247852192df8 (patch)
treed18d4e7498c60cf5bf19a12fbe881399ce455778 /polly/lib/CodeGen/IslCodeGeneration.cpp
parentb92e9164d24399b2b46ac4210324b7be6106d446 (diff)
downloadbcm5719-llvm-0b169c0cab663b8708d30e37bebe247852192df8.tar.gz
bcm5719-llvm-0b169c0cab663b8708d30e37bebe247852192df8.zip
Add verifier to the IslCodeGeneration
After a function was created we will verify it for Debug builds. If errors are found and debug-type equals "polly-codegen-isl" the SCoP, the isl AST, the function as well as the errors will be printed. llvm-svn: 230767
Diffstat (limited to 'polly/lib/CodeGen/IslCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/IslCodeGeneration.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp
index a3876f19509..df0654de378 100644
--- a/polly/lib/CodeGen/IslCodeGeneration.cpp
+++ b/polly/lib/CodeGen/IslCodeGeneration.cpp
@@ -41,6 +41,7 @@
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/IR/Verifier.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -920,6 +921,25 @@ public:
return RTC;
}
+ bool verifyGeneratedFunction(Scop &S, Function &F) {
+ if (!verifyFunction(F))
+ return false;
+
+ DEBUG({
+ errs() << "== ISL Codegen created an invalid function ==\n\n== The "
+ "SCoP ==\n";
+ S.print(errs());
+ errs() << "\n== The isl AST ==\n";
+ AI->printScop(errs());
+ errs() << "\n== The invalid function ==\n";
+ F.print(errs());
+ errs() << "\n== The errors ==\n";
+ verifyFunction(F, &errs());
+ });
+
+ return true;
+ }
+
bool runOnScop(Scop &S) {
AI = &getAnalysis<IslAstInfo>();
@@ -951,6 +971,9 @@ public:
Builder.SetInsertPoint(StartBlock->begin());
NodeBuilder.create(AstRoot);
+
+ assert(!verifyGeneratedFunction(S, *EnteringBB->getParent()) &&
+ "Verification of generated function failed");
return true;
}
OpenPOWER on IntegriCloud