diff options
| author | Tobias Grosser <tobias@grosser.es> | 2016-07-24 06:43:21 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2016-07-24 06:43:21 +0000 |
| commit | 9a18d55947afc0ace5490da5c06aad7fd9d037c0 (patch) | |
| tree | 8990abfba8c5110f1bd25f6b13fb6915f3878110 /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
| parent | e1a98343a1f8b00b2df9572baa9151ac80e77a29 (diff) | |
| download | bcm5719-llvm-9a18d55947afc0ace5490da5c06aad7fd9d037c0.tar.gz bcm5719-llvm-9a18d55947afc0ace5490da5c06aad7fd9d037c0.zip | |
GPGPU: Optimize kernel IR before generating assembly code
We optimize the kernel _after_ dumping the IR we generate to make the IR we
dump easier readable and independent of possible changes in the general
purpose LLVM optimizers.
llvm-svn: 276551
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 420b3eec356..a4609bfacf4 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -32,6 +32,7 @@ #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "isl/union_map.h" @@ -683,6 +684,14 @@ void GPUNodeBuilder::finalizeKernelFunction() { if (DumpKernelIR) outs() << *GPUModule << "\n"; + // Optimize module. + llvm::legacy::PassManager OptPasses; + PassManagerBuilder PassBuilder; + PassBuilder.OptLevel = 3; + PassBuilder.SizeLevel = 0; + PassBuilder.populateModulePassManager(OptPasses); + OptPasses.run(*GPUModule); + std::string Assembly = createKernelASM(); if (DumpKernelASM) |

