mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 02:37:37 +00:00
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
This commit is contained in:
parent
a30c69c9e4
commit
e6e3c9246a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user