[PATCH] Long compile time with Polly
Sanjin Sijaric
ssijaric at codeaurora.org
Thu Mar 5 02:40:11 PST 2015
Hi grosser, _jdoerfert, zinob,
We came across a case where compiling one file (of many) in a customer application took 1m24s with a Release build vs 10s with a Release+Asserts build. The problem is that RegionBase<Tr>::getNameStr() is very expensive when the region's entry or exit block doesn't have a name, which is the case in the Release build as clang doesn't preserve names. The main use of RegionBase<Tr>::getNameStr() is to generate the message string when calling dumpPassInfo. This fix just adds the checks that we are actually generating debug pass information, and thus avoids the call to RegionBase<Tr>::getNameStr() otherwise. With this change, the compile time for a Release only build goes down to 8s.
The long compile time will still be present when -debug-pass flag is used in a Release build. If that should also be fixed, perhaps we can just create an empty string upfront if NDEBUG is set and the region's entry or exit block doesn't have a name.
http://reviews.llvm.org/D8076
Files:
lib/Analysis/RegionPass.cpp
Index: lib/Analysis/RegionPass.cpp
===================================================================
--- lib/Analysis/RegionPass.cpp
+++ lib/Analysis/RegionPass.cpp
@@ -83,9 +83,11 @@
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
RegionPass *P = (RegionPass*)getContainedPass(Index);
- dumpPassInfo(P, EXECUTION_MSG, ON_REGION_MSG,
- CurrentRegion->getNameStr());
- dumpRequiredSet(P);
+ if (isPassDebuggingExecutionsOrMore()) {
+ dumpPassInfo(P, EXECUTION_MSG, ON_REGION_MSG,
+ CurrentRegion->getNameStr());
+ dumpRequiredSet(P);
+ }
initializeAnalysisImpl(P);
@@ -96,11 +98,13 @@
Changed |= P->runOnRegion(CurrentRegion, *this);
}
- if (Changed)
- dumpPassInfo(P, MODIFICATION_MSG, ON_REGION_MSG,
- skipThisRegion ? "<deleted>" :
- CurrentRegion->getNameStr());
- dumpPreservedSet(P);
+ if (isPassDebuggingExecutionsOrMore()) {
+ if (Changed)
+ dumpPassInfo(P, MODIFICATION_MSG, ON_REGION_MSG,
+ skipThisRegion ? "<deleted>" :
+ CurrentRegion->getNameStr());
+ dumpPreservedSet(P);
+ }
if (!skipThisRegion) {
// Manually check that this region is still healthy. This is done
@@ -120,8 +124,8 @@
removeNotPreservedAnalysis(P);
recordAvailableAnalysis(P);
removeDeadPasses(P,
- skipThisRegion ? "<deleted>" :
- CurrentRegion->getNameStr(),
+ (!isPassDebuggingExecutionsOrMore() || skipThisRegion) ?
+ "<deleted>" : CurrentRegion->getNameStr(),
ON_REGION_MSG);
if (skipThisRegion)
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8076.21264.patch
Type: text/x-patch
Size: 1860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150305/b19b1ae7/attachment.bin>
More information about the llvm-commits
mailing list