Skip to content

Commit

Permalink
Moving ManagedMemoryRewritePass when hybrid option is selected
Browse files Browse the repository at this point in the history
Compiling with -polly-target=hybrid was causing Polly to occur two times
in the pipeline. The reason was how the ManagedMemoryRewritePass was
registered in the pass manager. ManagedMemoryRewritePass being a
ModulePass was forcing all previous passes to get recomputed. This
commit avoids Polly to appear two times in the pipeline registering the
ManagedMemoryRewritePass later in the pass manager.

Patch by Lorenzo Chelini <l.chelini@icloud.com>

Differential Revision: https://reviews.llvm.org/D59263

llvm-svn: 356965
  • Loading branch information
Meinersbur committed Mar 25, 2019
1 parent 1181c9f commit ea40d5b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions polly/lib/Support/RegisterPasses.cpp
Expand Up @@ -349,12 +349,9 @@ void registerPollyPasses(llvm::legacy::PassManagerBase &PM) {
PM.add(polly::createPruneUnprofitablePass());

#ifdef GPU_CODEGEN
if (Target == TARGET_HYBRID) {
if (Target == TARGET_HYBRID)
PM.add(
polly::createPPCGCodeGenerationPass(GPUArchChoice, GPURuntimeChoice));
PM.add(polly::createManagedMemoryRewritePassPass(GPUArchChoice,
GPURuntimeChoice));
}
#endif
if (Target == TARGET_CPU || Target == TARGET_HYBRID)
switch (Optimizer) {
Expand Down Expand Up @@ -388,6 +385,12 @@ void registerPollyPasses(llvm::legacy::PassManagerBase &PM) {
}
#endif

#ifdef GPU_CODEGEN
if (Target == TARGET_HYBRID)
PM.add(polly::createManagedMemoryRewritePassPass(GPUArchChoice,
GPURuntimeChoice));
#endif

// FIXME: This dummy ModulePass keeps some programs from miscompiling,
// probably some not correctly preserved analyses. It acts as a barrier to
// force all analysis results to be recomputed.
Expand Down

0 comments on commit ea40d5b

Please sign in to comment.