summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/PPCGCodeGeneration.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-09-12 06:06:31 +0000
committerTobias Grosser <tobias@grosser.es>2016-09-12 06:06:31 +0000
commit5857b701a3bf45baa5fa5ba99fef725615719f6b (patch)
tree44cd84ccf795cf840418d5efe6b783435e41b295 /polly/lib/CodeGen/PPCGCodeGeneration.cpp
parentb6a3b4ba61383774dae692efb5767ffdb23ac36e (diff)
downloadbcm5719-llvm-5857b701a3bf45baa5fa5ba99fef725615719f6b.tar.gz
bcm5719-llvm-5857b701a3bf45baa5fa5ba99fef725615719f6b.zip
GPGPU: Bail out gracefully in case of invalid IR
Instead of aborting, we now bail out gracefully in case the kernel IR we generate is invalid. This can currently happen in case the SCoP stores pointer values, which we model as arrays, as data values into other arrays. In this case, the original pointer value is not available on the device and can consequently not be stored. As detecting this ahead of time is not so easy, we detect these situations after the invalid IR has been generated and bail out. llvm-svn: 281193
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 66ffa730acc..783d256a32c 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -152,6 +152,12 @@ public:
/// Finalize the generated scop.
virtual void finalize();
+ /// Track if the full build process was successful.
+ ///
+ /// This value is set to false, if throughout the build process an error
+ /// occurred which prevents us from generating valid GPU code.
+ bool BuildSuccessful = true;
+
private:
/// A vector of array base pointers for which a new ScopArrayInfo was created.
///
@@ -1409,10 +1415,10 @@ std::string GPUNodeBuilder::createKernelASM() {
}
std::string GPUNodeBuilder::finalizeKernelFunction() {
- // Verify module.
- llvm::legacy::PassManager Passes;
- Passes.add(createVerifierPass());
- Passes.run(*GPUModule);
+ if (verifyModule(*GPUModule)) {
+ BuildSuccessful = false;
+ return "";
+ }
if (DumpKernelIR)
outs() << *GPUModule << "\n";
@@ -2139,6 +2145,9 @@ public:
NodeBuilder.initializeAfterRTH();
NodeBuilder.create(Root);
NodeBuilder.finalize();
+
+ if (!NodeBuilder.BuildSuccessful)
+ SplitBlock->getTerminator()->setOperand(0, Builder.getFalse());
}
bool runOnScop(Scop &CurrentScop) override {
OpenPOWER on IntegriCloud