diff options
| author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-05-12 20:21:50 +0000 |
|---|---|---|
| committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-05-12 20:21:50 +0000 |
| commit | e6e3c9246a67025fd25b54b73134da4ebe4a89ff (patch) | |
| tree | 9fb3e5138965dd4c58c3afd575581751c4e907a1 /polly/lib/Analysis/ScopDetection.cpp | |
| parent | a30c69c9e43bef7a1e037a3f183531543f7676b0 (diff) | |
| download | bcm5719-llvm-e6e3c9246a67025fd25b54b73134da4ebe4a89ff.tar.gz bcm5719-llvm-e6e3c9246a67025fd25b54b73134da4ebe4a89ff.zip | |
Check late for profitability
Before this patch we only expanded valid __and__ profitable region. Therefor
we did not allow the expansion to create a profitable region from a
non-profitable one. With this patch we will remember and expand all valid
regions and check for profitability only at the end.
This patch increases the number of valid SCoPs in the LLVM-TS and SPEC
2000/2006 by 28% (from 303 to 390), including the hot loop in hmmer.
llvm-svn: 269343
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index fedca6fd206..52f57d6ec2c 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1350,9 +1350,6 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const { return invalid<ReportIrreducibleRegion>(Context, /*Assert=*/true, &CurRegion, DbgLoc); - if (!isProfitableRegion(Context)) - return false; - DEBUG(dbgs() << "OK\n"); return true; } @@ -1472,6 +1469,19 @@ bool ScopDetection::runOnFunction(llvm::Function &F) { findScops(*TopRegion); + // Prune non-profitable regions. + for (auto &DIt : DetectionContextMap) { + auto &DC = DIt.getSecond(); + if (DC.Log.hasErrors()) + continue; + if (!ValidRegions.count(&DC.CurRegion)) + continue; + if (isProfitableRegion(DC)) + continue; + + ValidRegions.remove(&DC.CurRegion); + } + // Only makes sense when we tracked errors. if (PollyTrackFailures) emitMissedRemarks(F); |

