[polly] speedup compile time for functions with no loops
    Sebastian Pop 
    spop at codeaurora.org
       
    Wed May 29 09:58:50 PDT 2013
    
    
  
Hi,
when compiling c++ code (or c code with a lot of functions), scop detection
shows a huge overhead: probably 1/3 of the compile time is spent in scop
detection trying to find out maximal regions in functions with no loops.
Here is a preliminary patch (does not fix the testsuite) that disables scop
detection on functions with no loops:
diff --git a/lib/Analysis/ScopDetection.cpp b/lib/Analysis/ScopDetection.cpp
index ab323fd..ee2721d 100644
--- a/lib/Analysis/ScopDetection.cpp
+++ b/lib/Analysis/ScopDetection.cpp
@@ -785,9 +785,12 @@ void
ScopDetection::printInvalidLocations(llvm::Function &F) {
 }
 bool ScopDetection::runOnFunction(llvm::Function &F) {
+  LI = &getAnalysisID<LoopInfo>(LoopInfo::getClassPassID());
+  if (LI->empty())
+    return false;
+
   AA = &getAnalysisID<AliasAnalysis>(AliasAnalysis::getClassPassID());
   SE = &getAnalysisID<ScalarEvolution>(ScalarEvolution::getClassPassID());
-  LI = &getAnalysisID<LoopInfo>(LoopInfo::getClassPassID());
   RI = &getAnalysisID<RegionInfo>(RegionInfo::getClassPassID());
   Region *TopRegion = RI->getTopLevelRegion();
My question is how do you want to fix the testsuite? Do you want to remove or
rewrite the files that check for patterns in functions with no loops, or do you
want to add a flag to enable scop detection even with no loops in a function?
I would prefer the flag solution: it's the easiest way for me to fix
the testsuite.
Thanks,
Sebastian
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
    
    
More information about the llvm-commits
mailing list