[llvm] r243247 - bugpoint: make the number of trim iterations a compile-time constant

Tobias Grosser tobias at grosser.es
Sun Jul 26 08:18:45 PDT 2015


Author: grosser
Date: Sun Jul 26 10:18:45 2015
New Revision: 243247

URL: http://llvm.org/viewvc/llvm-project?rev=243247&view=rev
Log:
bugpoint: make the number of trim iterations a compile-time constant

Around 10 year ago Chris limited this code to a single iteration by just
dropping a break into the loop body. We now make the number of trim iterations
a compile time constant to be able to play with it and see if this can
improve the bugpoint results. We currently use with '3' still a small and
conservative value, but this can be adjusted in the future, if needed.

I tried to look for a trivial test case, but did not succeed yet.

Modified:
    llvm/trunk/tools/bugpoint/ListReducer.h

Modified: llvm/trunk/tools/bugpoint/ListReducer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ListReducer.h?rev=243247&r1=243246&r2=243247&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ListReducer.h (original)
+++ llvm/trunk/tools/bugpoint/ListReducer.h Sun Jul 26 10:18:45 2015
@@ -75,6 +75,11 @@ struct ListReducer {
     // Maximal number of allowed splitting iterations,
     // before the elements are randomly shuffled.
     const unsigned MaxIterationsWithoutProgress = 3;
+
+    // Maximal number of allowed single-element trim iterations. We add a
+    // threshhold here as single-element reductions may otherwise take a
+    // very long time to complete.
+    const unsigned MaxTrimIterationsWithoutBackJump = 3;
     bool ShufflingEnabled = true;
 
 Backjump:
@@ -157,6 +162,7 @@ Backjump:
     if (TheList.size() > 2) {
       bool Changed = true;
       std::vector<ElTy> EmptyList;
+      unsigned TrimIterations = 0;
       while (Changed) {  // Trimming loop.
         Changed = false;
         
@@ -186,9 +192,9 @@ Backjump:
           if (!Error.empty())
             return true;
         }
-        // This can take a long time if left uncontrolled.  For now, don't
-        // iterate.
-        break;
+        if (TrimIterations >= MaxTrimIterationsWithoutBackJump)
+          break;
+        TrimIterations++;
       }
     }
 





More information about the llvm-commits mailing list