aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-reduce/DeltaManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-reduce/DeltaManager.cpp')
-rw-r--r--llvm/tools/llvm-reduce/DeltaManager.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index 4abdf38..d3e8740 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -24,6 +24,7 @@
#include "deltas/ReduceGlobalValues.h"
#include "deltas/ReduceGlobalVarInitializers.h"
#include "deltas/ReduceGlobalVars.h"
+#include "deltas/ReduceIRReferences.h"
#include "deltas/ReduceInstructions.h"
#include "deltas/ReduceInstructionsMIR.h"
#include "deltas/ReduceMetadata.h"
@@ -67,7 +68,11 @@ static cl::opt<std::string>
DELTA_PASS("module-data", reduceModuleDataDeltaPass)
#define DELTA_PASSES_MIR \
- DELTA_PASS("instructions", reduceInstructionsMIRDeltaPass)
+ DELTA_PASS("instructions", reduceInstructionsMIRDeltaPass) \
+ DELTA_PASS("ir-instruction-references", \
+ reduceIRInstructionReferencesDeltaPass) \
+ DELTA_PASS("ir-block-references", reduceIRBlockReferencesDeltaPass) \
+ DELTA_PASS("ir-function-references", reduceIRFunctionReferencesDeltaPass)
static void runAllDeltaPasses(TestRunner &Tester) {
#define DELTA_PASS(NAME, FUNC) FUNC(Tester);
@@ -105,18 +110,8 @@ void llvm::printDeltaPasses(raw_ostream &OS) {
#undef DELTA_PASS
}
-// FIXME: We might want to use a different metric than "number of
-// bytes in serialized IR" to detect non-progress of the main delta
-// loop
-static int getIRSize(TestRunner &Tester) {
- std::string Str;
- raw_string_ostream SS(Str);
- Tester.getProgram().print(SS, /*AnnotationWriter=*/nullptr);
- return Str.length();
-}
-
void llvm::runDeltaPasses(TestRunner &Tester, int MaxPassIterations) {
- int OldSize = getIRSize(Tester);
+ uint64_t OldComplexity = Tester.getProgram().getComplexityScore();
for (int Iter = 0; Iter < MaxPassIterations; ++Iter) {
if (DeltaPasses.empty()) {
runAllDeltaPasses(Tester);
@@ -128,9 +123,9 @@ void llvm::runDeltaPasses(TestRunner &Tester, int MaxPassIterations) {
Passes = Split.second;
}
}
- int NewSize = getIRSize(Tester);
- if (NewSize >= OldSize)
+ uint64_t NewComplexity = Tester.getProgram().getComplexityScore();
+ if (NewComplexity >= OldComplexity)
break;
- OldSize = NewSize;
+ OldComplexity = NewComplexity;
}
}