diff options
| author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-08-21 11:44:01 +0000 |
|---|---|---|
| committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-08-21 11:44:01 +0000 |
| commit | 7b9f5ca27ea2d3ef5359d2916463d1a5d8315979 (patch) | |
| tree | 529d89ec74d6ba6d00594a177073edece90ca863 /polly/lib/CodeGen | |
| parent | 685889cf9b50ed00ee034d0ee067b75d0fb44283 (diff) | |
| download | bcm5719-llvm-7b9f5ca27ea2d3ef5359d2916463d1a5d8315979.tar.gz bcm5719-llvm-7b9f5ca27ea2d3ef5359d2916463d1a5d8315979.zip | |
[PPCGCodeGeneration] Enable `polly-codegen-perf-monitoring` for PPCGCodegen.
This feature was not enabled for `PPCGCodeGeneration`. Now that this is
enabled, we can benchmark Scops that have been optimised with
`-polly-codegen-ppcg` with the `-polly-codegen-perf-monitoring` option.
Differential Revision: https://reviews.llvm.org/D36934
llvm-svn: 311328
Diffstat (limited to 'polly/lib/CodeGen')
| -rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 10 | ||||
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 19 |
2 files changed, 25 insertions, 4 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 76022d7b594..d362ffbfaf1 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -49,10 +49,12 @@ static cl::opt<bool> Verify("polly-codegen-verify", cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory)); -static cl::opt<bool> - PerfMonitoring("polly-codegen-perf-monitoring", - cl::desc("Add run-time performance monitoring"), cl::Hidden, - cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory)); +bool polly::PerfMonitoring; +static cl::opt<bool, true> + XPerfMonitoring("polly-codegen-perf-monitoring", + cl::desc("Add run-time performance monitoring"), cl::Hidden, + cl::location(polly::PerfMonitoring), cl::init(false), + cl::ZeroOrMore, cl::cat(PollyCategory)); namespace polly { /// Mark a basic block unreachable. diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index aa4886dc070..28fa9e6b553 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -16,6 +16,7 @@ #include "polly/CodeGen/CodeGeneration.h" #include "polly/CodeGen/IslAst.h" #include "polly/CodeGen/IslNodeBuilder.h" +#include "polly/CodeGen/PerfMonitor.h" #include "polly/CodeGen/Utils.h" #include "polly/DependenceInfo.h" #include "polly/LinkAllPasses.h" @@ -122,6 +123,8 @@ static cl::opt<int> cl::desc("Minimal number of compute statements to run on GPU."), cl::Hidden, cl::init(10 * 512 * 512)); +extern bool polly::PerfMonitoring; + /// Return a unique name for a Scop, which is the scop region with the /// function name. std::string getUniqueScopName(const Scop *S) { @@ -3433,6 +3436,22 @@ public: isl_ast_node_free(Root); } else { + if (polly::PerfMonitoring) { + PerfMonitor P(*S, EnteringBB->getParent()->getParent()); + P.initialize(); + P.insertRegionStart(SplitBlock->getTerminator()); + + // TODO: actually think if this is the correct exiting block to place + // the `end` performance marker. Invariant load hoisting changes + // the CFG in a way that I do not precisely understand, so I + // (Siddharth<siddu.druid@gmail.com>) should come back to this and + // think about which exiting block to use. + auto *ExitingBlock = StartBlock->getUniqueSuccessor(); + assert(ExitingBlock); + BasicBlock *MergeBlock = ExitingBlock->getUniqueSuccessor(); + P.insertRegionEnd(MergeBlock->getTerminator()); + } + NodeBuilder.addParameters(S->getContext().release()); Value *RTC = NodeBuilder.createRTC(Condition); Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC); |

