[polly] r302134 - [ScopDetection] Check for already known required-invariant loads [NFC]

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 03:16:20 PDT 2017


Author: grosser
Date: Thu May  4 05:16:20 2017
New Revision: 302134

URL: http://llvm.org/viewvc/llvm-project?rev=302134&view=rev
Log:
[ScopDetection] Check for already known required-invariant loads [NFC]

For certain test cases we spent over 50% of the scop detection time in
checking if a load is likely invariant. We can avoid most of these checks by
testing early on if a load is expected to be invariant. Doing this reduces
scop-detection time on a large benchmark from 52 seconds to just 25 seconds.

No functional change is expected.

Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=302134&r1=302133&r2=302134&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu May  4 05:16:20 2017
@@ -350,6 +350,14 @@ bool ScopDetection::onlyValidRequiredInv
     return false;
 
   for (LoadInst *Load : RequiredILS) {
+    // If we already know a load has been accepted as required invariant, we
+    // already run the validation below once and consequently don't need to
+    // run it again. Hence, we return early. For certain test cases (e.g.,
+    // COSMO this avoids us spending 50% of scop-detection time in this
+    // very function (and its children).
+    if (Context.RequiredILS.count(Load))
+      continue;
+
     if (!isHoistableLoad(Load, CurRegion, *LI, *SE, *DT))
       return false;
 




More information about the llvm-commits mailing list