[llvm] [llvm-reduce]: print short form, actionable names in the log (PR #133561)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 29 20:54:04 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/133561
>From 128425468e7cfb825abbd3eb81233af792986f2d Mon Sep 17 00:00:00 2001
From: YLChenZ <chentongyongcz at gmail.com>
Date: Sat, 29 Mar 2025 10:47:04 +0800
Subject: [PATCH 1/8] [llvm-reduce]: print short form, actionable names in the
log
---
llvm/tools/llvm-reduce/DeltaManager.cpp | 141 +++++++-----------
llvm/tools/llvm-reduce/DeltaPass.h | 20 +++
llvm/tools/llvm-reduce/DeltaPasses.def | 68 +++++++++
llvm/tools/llvm-reduce/deltas/Delta.h | 1 +
.../llvm-reduce/deltas/ReduceAliases.cpp | 15 +-
llvm/tools/llvm-reduce/deltas/ReduceAliases.h | 4 +-
.../llvm-reduce/deltas/ReduceArguments.cpp | 9 +-
.../llvm-reduce/deltas/ReduceArguments.h | 2 +-
.../llvm-reduce/deltas/ReduceAttributes.cpp | 9 +-
.../llvm-reduce/deltas/ReduceAttributes.h | 5 +-
.../llvm-reduce/deltas/ReduceBasicBlocks.cpp | 17 +--
.../llvm-reduce/deltas/ReduceBasicBlocks.h | 7 +-
.../llvm-reduce/deltas/ReduceDIMetadata.cpp | 9 +-
.../llvm-reduce/deltas/ReduceDIMetadata.h | 4 +-
.../llvm-reduce/deltas/ReduceDbgRecords.cpp | 10 +-
.../llvm-reduce/deltas/ReduceDbgRecords.h | 4 +-
.../deltas/ReduceDistinctMetadata.cpp | 12 +-
.../deltas/ReduceDistinctMetadata.h | 4 +-
.../deltas/ReduceFunctionBodies.cpp | 15 +-
.../llvm-reduce/deltas/ReduceFunctionBodies.h | 4 +-
.../llvm-reduce/deltas/ReduceFunctions.cpp | 10 +-
.../llvm-reduce/deltas/ReduceFunctions.h | 3 +-
.../deltas/ReduceGlobalObjects.cpp | 8 +-
.../llvm-reduce/deltas/ReduceGlobalObjects.h | 2 +-
.../llvm-reduce/deltas/ReduceGlobalValues.cpp | 8 +-
.../llvm-reduce/deltas/ReduceGlobalValues.h | 2 +-
.../deltas/ReduceGlobalVarInitializers.cpp | 11 +-
.../deltas/ReduceGlobalVarInitializers.h | 4 +-
.../llvm-reduce/deltas/ReduceGlobalVars.cpp | 10 +-
.../llvm-reduce/deltas/ReduceGlobalVars.h | 4 +-
.../llvm-reduce/deltas/ReduceIRReferences.cpp | 26 +---
.../llvm-reduce/deltas/ReduceIRReferences.h | 10 +-
.../deltas/ReduceInstructionFlags.cpp | 10 +-
.../deltas/ReduceInstructionFlags.h | 4 +-
.../deltas/ReduceInstructionFlagsMIR.cpp | 10 +-
.../deltas/ReduceInstructionFlagsMIR.h | 2 +-
.../llvm-reduce/deltas/ReduceInstructions.cpp | 8 +-
.../llvm-reduce/deltas/ReduceInstructions.h | 4 +-
.../deltas/ReduceInstructionsMIR.cpp | 11 +-
.../deltas/ReduceInstructionsMIR.h | 6 +-
.../llvm-reduce/deltas/ReduceInvokes.cpp | 9 +-
llvm/tools/llvm-reduce/deltas/ReduceInvokes.h | 4 +-
.../deltas/ReduceMemoryOperations.cpp | 24 +--
.../deltas/ReduceMemoryOperations.h | 8 +-
.../llvm-reduce/deltas/ReduceMetadata.cpp | 15 +-
.../tools/llvm-reduce/deltas/ReduceMetadata.h | 6 +-
.../llvm-reduce/deltas/ReduceModuleData.cpp | 8 +-
.../llvm-reduce/deltas/ReduceModuleData.h | 2 +-
.../llvm-reduce/deltas/ReduceOpcodes.cpp | 9 +-
llvm/tools/llvm-reduce/deltas/ReduceOpcodes.h | 4 +-
.../deltas/ReduceOperandBundles.cpp | 11 +-
.../llvm-reduce/deltas/ReduceOperandBundles.h | 5 +-
.../llvm-reduce/deltas/ReduceOperands.cpp | 29 +---
.../tools/llvm-reduce/deltas/ReduceOperands.h | 6 +-
.../llvm-reduce/deltas/ReduceOperandsSkip.cpp | 9 +-
.../llvm-reduce/deltas/ReduceOperandsSkip.h | 2 +-
.../deltas/ReduceOperandsToArgs.cpp | 10 +-
.../llvm-reduce/deltas/ReduceOperandsToArgs.h | 2 +-
.../llvm-reduce/deltas/ReduceRegisterDefs.cpp | 9 +-
.../llvm-reduce/deltas/ReduceRegisterDefs.h | 2 +-
.../deltas/ReduceRegisterMasks.cpp | 9 +-
.../llvm-reduce/deltas/ReduceRegisterMasks.h | 2 +-
.../llvm-reduce/deltas/ReduceRegisterUses.cpp | 9 +-
.../llvm-reduce/deltas/ReduceRegisterUses.h | 2 +-
.../deltas/ReduceSpecialGlobals.cpp | 11 +-
.../llvm-reduce/deltas/ReduceSpecialGlobals.h | 2 +-
.../deltas/ReduceUsingSimplifyCFG.cpp | 28 ++--
.../deltas/ReduceUsingSimplifyCFG.h | 6 +-
.../deltas/ReduceVirtualRegisters.cpp | 12 +-
.../deltas/ReduceVirtualRegisters.h | 4 +-
llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp | 9 +-
llvm/tools/llvm-reduce/deltas/RunIRPasses.h | 2 +-
.../deltas/SimplifyInstructions.cpp | 6 +-
.../llvm-reduce/deltas/SimplifyInstructions.h | 2 +-
.../llvm-reduce/deltas/StripDebugInfo.cpp | 7 +-
.../tools/llvm-reduce/deltas/StripDebugInfo.h | 2 +-
76 files changed, 329 insertions(+), 471 deletions(-)
create mode 100644 llvm/tools/llvm-reduce/DeltaPass.h
create mode 100644 llvm/tools/llvm-reduce/DeltaPasses.def
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index 624b5306bc71b..699e5e5dd523b 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "DeltaManager.h"
+#include "DeltaPass.h"
#include "ReducerWorkItem.h"
#include "TestRunner.h"
#include "deltas/Delta.h"
@@ -71,91 +72,64 @@ static cl::list<std::string>
"default, run all delta passes."),
cl::cat(LLVMReduceOptions), cl::CommaSeparated);
-#define DELTA_PASSES \
- do { \
- DELTA_PASS("strip-debug-info", stripDebugInfoDeltaPass) \
- DELTA_PASS("functions", reduceFunctionsDeltaPass) \
- DELTA_PASS("function-bodies", reduceFunctionBodiesDeltaPass) \
- DELTA_PASS("special-globals", reduceSpecialGlobalsDeltaPass) \
- DELTA_PASS("aliases", reduceAliasesDeltaPass) \
- DELTA_PASS("ifuncs", reduceIFuncsDeltaPass) \
- DELTA_PASS("simplify-conditionals-true", reduceConditionalsTrueDeltaPass) \
- DELTA_PASS("simplify-conditionals-false", \
- reduceConditionalsFalseDeltaPass) \
- DELTA_PASS("invokes", reduceInvokesDeltaPass) \
- DELTA_PASS("unreachable-basic-blocks", \
- reduceUnreachableBasicBlocksDeltaPass) \
- DELTA_PASS("basic-blocks", reduceBasicBlocksDeltaPass) \
- DELTA_PASS("simplify-cfg", reduceUsingSimplifyCFGDeltaPass) \
- DELTA_PASS("function-data", reduceFunctionDataDeltaPass) \
- DELTA_PASS("global-values", reduceGlobalValuesDeltaPass) \
- DELTA_PASS("global-objects", reduceGlobalObjectsDeltaPass) \
- DELTA_PASS("global-initializers", reduceGlobalsInitializersDeltaPass) \
- DELTA_PASS("global-variables", reduceGlobalsDeltaPass) \
- DELTA_PASS("di-metadata", reduceDIMetadataDeltaPass) \
- DELTA_PASS("dbg-records", reduceDbgRecordDeltaPass) \
- DELTA_PASS("distinct-metadata", reduceDistinctMetadataDeltaPass) \
- DELTA_PASS("metadata", reduceMetadataDeltaPass) \
- DELTA_PASS("named-metadata", reduceNamedMetadataDeltaPass) \
- DELTA_PASS("arguments", reduceArgumentsDeltaPass) \
- DELTA_PASS("instructions", reduceInstructionsDeltaPass) \
- DELTA_PASS("simplify-instructions", simplifyInstructionsDeltaPass) \
- DELTA_PASS("ir-passes", runIRPassesDeltaPass) \
- DELTA_PASS("operands-zero", reduceOperandsZeroDeltaPass) \
- DELTA_PASS("operands-one", reduceOperandsOneDeltaPass) \
- DELTA_PASS("operands-nan", reduceOperandsNaNDeltaPass) \
- DELTA_PASS("operands-to-args", reduceOperandsToArgsDeltaPass) \
- DELTA_PASS("operands-skip", reduceOperandsSkipDeltaPass) \
- DELTA_PASS("operand-bundles", reduceOperandBundesDeltaPass) \
- DELTA_PASS("attributes", reduceAttributesDeltaPass) \
- DELTA_PASS("module-data", reduceModuleDataDeltaPass) \
- DELTA_PASS("opcodes", reduceOpcodesDeltaPass) \
- DELTA_PASS("volatile", reduceVolatileInstructionsDeltaPass) \
- DELTA_PASS("atomic-ordering", reduceAtomicOrderingDeltaPass) \
- DELTA_PASS("syncscopes", reduceAtomicSyncScopesDeltaPass) \
- DELTA_PASS("instruction-flags", reduceInstructionFlagsDeltaPass) \
- } while (false)
-
-#define DELTA_PASSES_MIR \
- do { \
- DELTA_PASS("instructions", reduceInstructionsMIRDeltaPass) \
- DELTA_PASS("ir-instruction-references", \
- reduceIRInstructionReferencesDeltaPass) \
- DELTA_PASS("ir-block-references", reduceIRBlockReferencesDeltaPass) \
- DELTA_PASS("ir-function-references", reduceIRFunctionReferencesDeltaPass) \
- DELTA_PASS("instruction-flags", reduceInstructionFlagsMIRDeltaPass) \
- DELTA_PASS("register-uses", reduceRegisterUsesMIRDeltaPass) \
- DELTA_PASS("register-defs", reduceRegisterDefsMIRDeltaPass) \
- DELTA_PASS("register-hints", reduceVirtualRegisterHintsDeltaPass) \
- DELTA_PASS("register-masks", reduceRegisterMasksMIRDeltaPass) \
- } while (false)
+// Generate two separate Pass lists: IR_Passes and MIR_Passes
+static const DeltaPass IR_Passes[] = {
+#undef DELTA_PASS_IR
+#undef DELTA_PASS_MIR
+#define DELTA_PASS_IR(NAME, FUNC, DESC) {NAME, FUNC, DESC},
+#include "DeltaPasses.def"
+#undef DELTA_PASS_IR
+};
+
+static const DeltaPass MIR_Passes[] = {
+#undef DELTA_PASS_IR
+#undef DELTA_PASS_MIR
+#define DELTA_PASS_MIR(NAME, FUNC, DESC) {NAME, FUNC, DESC},
+#include "DeltaPasses.def"
+#undef DELTA_PASS_MIR
+};
+
+static SmallString<64> getPassMessage(const DeltaPass &Pass) {
+ SmallString<64> Message = Pass.Desc;
+ Message += " (";
+ Message += Pass.Name;
+ Message += ')';
+ return Message;
+}
static void runAllDeltaPasses(TestRunner &Tester,
const SmallStringSet &SkipPass) {
-#define DELTA_PASS(NAME, FUNC) \
- if (!SkipPass.count(NAME)) { \
- FUNC(Tester); \
- }
if (Tester.getProgram().isMIR()) {
- DELTA_PASSES_MIR;
+ for (const DeltaPass &Pass : MIR_Passes) {
+ if (!SkipPass.count(Pass.Name)) {
+ runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ }
+ }
} else {
- DELTA_PASSES;
+ for (const DeltaPass &Pass : IR_Passes) {
+ if (!SkipPass.count(Pass.Name)) {
+ runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ }
+ }
}
-#undef DELTA_PASS
}
static void runDeltaPassName(TestRunner &Tester, StringRef PassName) {
-#define DELTA_PASS(NAME, FUNC) \
- if (PassName == NAME) { \
- FUNC(Tester); \
- return; \
- }
if (Tester.getProgram().isMIR()) {
- DELTA_PASSES_MIR;
+ for (const DeltaPass &Pass : MIR_Passes) {
+ if (PassName == Pass.Name) {
+ runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ return;
+ }
+ }
} else {
- DELTA_PASSES;
+ for (const DeltaPass &Pass : IR_Passes) {
+ if (PassName == Pass.Name) {
+ runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ return;
+ }
+ }
}
-#undef DELTA_PASS
// We should have errored on unrecognized passes before trying to run
// anything.
@@ -164,24 +138,25 @@ static void runDeltaPassName(TestRunner &Tester, StringRef PassName) {
void llvm::printDeltaPasses(raw_ostream &OS) {
OS << "Delta passes (pass to `--delta-passes=` as a comma separated list):\n";
-#define DELTA_PASS(NAME, FUNC) OS << " " << NAME << "\n";
OS << " IR:\n";
- DELTA_PASSES;
+ for (const DeltaPass &Pass : IR_Passes) {
+ OS << " " << Pass.Name << '\n';
+ }
OS << " MIR:\n";
- DELTA_PASSES_MIR;
-#undef DELTA_PASS
+ for (const DeltaPass &Pass : MIR_Passes) {
+ OS << " " << Pass.Name << '\n';
+ }
}
// Built a set of available delta passes.
static void collectPassNames(const TestRunner &Tester,
SmallStringSet &NameSet) {
-#define DELTA_PASS(NAME, FUNC) NameSet.insert(NAME);
- if (Tester.getProgram().isMIR()) {
- DELTA_PASSES_MIR;
- } else {
- DELTA_PASSES;
+ for (const DeltaPass &Pass : MIR_Passes) {
+ NameSet.insert(Pass.Name);
+ }
+ for (const DeltaPass &Pass : IR_Passes) {
+ NameSet.insert(Pass.Name);
}
-#undef DELTA_PASS
}
/// Verify all requested or skipped passes are valid names, and return them in a
diff --git a/llvm/tools/llvm-reduce/DeltaPass.h b/llvm/tools/llvm-reduce/DeltaPass.h
new file mode 100644
index 0000000000000..b11b84087c10e
--- /dev/null
+++ b/llvm/tools/llvm-reduce/DeltaPass.h
@@ -0,0 +1,20 @@
+//===--- DeltaPass.h - Delta Pass Structure --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
+#define LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
+
+namespace llvm {
+struct DeltaPass {
+ StringRef Name; // e.g., "strip-debug-info"
+ void (*Func)(Oracle &, ReducerWorkItem &); // e.g.,stripDebugInfoDeltaPass
+ StringRef Desc; // e.g., "Stripping Debug Info"
+};
+} // namespace llvm
+
+#endif
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/DeltaPasses.def b/llvm/tools/llvm-reduce/DeltaPasses.def
new file mode 100644
index 0000000000000..5ef3f79604918
--- /dev/null
+++ b/llvm/tools/llvm-reduce/DeltaPasses.def
@@ -0,0 +1,68 @@
+//===--- DeltaPasses.def - Delta Pass Definitions --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+
+#ifndef DELTA_PASS_IR
+#define DELTA_PASS_IR(NAME, FUNC, DESC)
+#endif
+DELTA_PASS_IR("strip-debug-info", stripDebugInfoDeltaPass, "Stripping Debug Info")
+DELTA_PASS_IR("functions", reduceFunctionsDeltaPass, "Reducing Functions")
+DELTA_PASS_IR("function-bodies", reduceFunctionBodiesDeltaPass, "Reducing Function Bodies")
+DELTA_PASS_IR("special-globals", reduceSpecialGlobalsDeltaPass, "Reducing Special Globals")
+DELTA_PASS_IR("aliases", reduceAliasesDeltaPass, "Reducing Aliases")
+DELTA_PASS_IR("ifuncs", reduceIFuncsDeltaPass, "Reducing Ifuncs")
+DELTA_PASS_IR("simplify-conditionals-true", reduceConditionalsTrueDeltaPass,"Reducing conditional branches to true")
+DELTA_PASS_IR("simplify-conditionals-false",
+ reduceConditionalsFalseDeltaPass,"Reducing conditional branches to false")
+DELTA_PASS_IR("invokes", reduceInvokesDeltaPass, "Reducing Invokes")
+DELTA_PASS_IR("unreachable-basic-blocks",
+ reduceUnreachableBasicBlocksDeltaPass, "Removing Unreachable Basic Blocks")
+DELTA_PASS_IR("basic-blocks", reduceBasicBlocksDeltaPass, "Reducing Basic Blocks")
+DELTA_PASS_IR("simplify-cfg", reduceUsingSimplifyCFGDeltaPass,"Reducing using SimplifyCFG")
+DELTA_PASS_IR("function-data", reduceFunctionDataDeltaPass, "Reducing Function Data")
+DELTA_PASS_IR("global-values", reduceGlobalValuesDeltaPass, "Reducing GlobalValues")
+DELTA_PASS_IR("global-objects", reduceGlobalObjectsDeltaPass, "Reducing GlobalObjects")
+DELTA_PASS_IR("global-initializers", reduceGlobalsInitializersDeltaPass, "Reducing GV Initializers")
+DELTA_PASS_IR("global-variables", reduceGlobalsDeltaPass, "Reducing GlobalVariables")
+DELTA_PASS_IR("di-metadata", reduceDIMetadataDeltaPass, "Reducing DIMetadata")
+DELTA_PASS_IR("dbg-records", reduceDbgRecordDeltaPass, "Reducing DbgRecords")
+DELTA_PASS_IR("distinct-metadata", reduceDistinctMetadataDeltaPass, "Reducing Distinct Metadata")
+DELTA_PASS_IR("metadata", reduceMetadataDeltaPass,"Reducing Metadata")
+DELTA_PASS_IR("named-metadata", reduceNamedMetadataDeltaPass,"Reducing Named Metadata")
+DELTA_PASS_IR("arguments", reduceArgumentsDeltaPass, "Reducing Arguments")
+DELTA_PASS_IR("instructions", reduceInstructionsDeltaPass, "Reducing Instructions")
+DELTA_PASS_IR("simplify-instructions", simplifyInstructionsDeltaPass,"Simplifying Instructions")
+DELTA_PASS_IR("ir-passes", runIRPassesDeltaPass,"Running passes")
+DELTA_PASS_IR("operands-zero", reduceOperandsZeroDeltaPass,"Reducing Operands to zero")
+DELTA_PASS_IR("operands-one", reduceOperandsOneDeltaPass,"Reducing Operands to one")
+DELTA_PASS_IR("operands-nan", reduceOperandsNaNDeltaPass,"Reducing Operands to NaN")
+DELTA_PASS_IR("operands-to-args", reduceOperandsToArgsDeltaPass,"Converting operands to function arguments")
+DELTA_PASS_IR("operands-skip", reduceOperandsSkipDeltaPass,"Reducing operands by skipping over instructions")
+DELTA_PASS_IR("operand-bundles", reduceOperandBundesDeltaPass,"Reducing Operand Bundles")
+DELTA_PASS_IR("attributes", reduceAttributesDeltaPass, "Reducing Attributes")
+DELTA_PASS_IR("module-data", reduceModuleDataDeltaPass,"Reducing Module Data")
+DELTA_PASS_IR("opcodes", reduceOpcodesDeltaPass,"Reducing Opcodes")
+DELTA_PASS_IR("volatile", reduceVolatileInstructionsDeltaPass,"Reducing Volatile Instructions")
+DELTA_PASS_IR("atomic-ordering", reduceAtomicOrderingDeltaPass,"Reducing Atomic Ordering")
+DELTA_PASS_IR("syncscopes", reduceAtomicSyncScopesDeltaPass,"Reducing Atomic Sync Scopes")
+DELTA_PASS_IR("instruction-flags", reduceInstructionFlagsDeltaPass, "Reducing Instruction Flags")
+
+
+#ifndef DELTA_PASS_MIR
+#define DELTA_PASS_MIR(NAME, FUNC, DESC)
+#endif
+DELTA_PASS_MIR("instructions", reduceInstructionsMIRDeltaPass, "Reducing Instructions")
+DELTA_PASS_MIR("ir-instruction-references",
+ reduceIRInstructionReferencesDeltaPass,"Reducing IR references from instructions")
+DELTA_PASS_MIR("ir-block-references", reduceIRBlockReferencesDeltaPass,"Reducing IR references from blocks")
+DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions")
+DELTA_PASS_MIR("instruction-flags", reduceInstructionFlagsMIRDeltaPass, "Reducing Instruction Flags")
+DELTA_PASS_MIR("register-uses", reduceRegisterUsesMIRDeltaPass,"Reducing register uses")
+DELTA_PASS_MIR("register-defs", reduceRegisterDefsMIRDeltaPass,"Reducing register defs")
+DELTA_PASS_MIR("register-hints", reduceVirtualRegisterHintsDeltaPass,"Reducing virtual register hints from functions")
+DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass,"Reducing register masks")
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.h b/llvm/tools/llvm-reduce/deltas/Delta.h
index 96fcea89484c0..0f12282e66d7d 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.h
+++ b/llvm/tools/llvm-reduce/deltas/Delta.h
@@ -17,6 +17,7 @@
#include "ReducerWorkItem.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <functional>
#include <utility>
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp b/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
index 2f2df549b6728..2dec80d7876e0 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceAliases.h"
-#include "Delta.h"
#include "Utils.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalValue.h"
@@ -22,7 +21,7 @@ using namespace llvm;
/// Removes all aliases aren't inside any of the
/// desired Chunks.
-static void extractAliasesFromModule(Oracle &O, ReducerWorkItem &Program) {
+void llvm::reduceAliasesDeltaPass(Oracle &O, ReducerWorkItem &Program) {
for (auto &GA : make_early_inc_range(Program.getModule().aliases())) {
if (!O.shouldKeep()) {
GA.replaceAllUsesWith(GA.getAliasee());
@@ -31,7 +30,7 @@ static void extractAliasesFromModule(Oracle &O, ReducerWorkItem &Program) {
}
}
-static void extractIFuncsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceIFuncsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Mod = WorkItem.getModule();
std::vector<GlobalIFunc *> IFuncs;
@@ -42,12 +41,4 @@ static void extractIFuncsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
if (!IFuncs.empty())
lowerGlobalIFuncUsersAsGlobalCtor(Mod, IFuncs);
-}
-
-void llvm::reduceAliasesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractAliasesFromModule, "Reducing Aliases");
-}
-
-void llvm::reduceIFuncsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractIFuncsFromModule, "Reducing Ifuncs");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceAliases.h b/llvm/tools/llvm-reduce/deltas/ReduceAliases.h
index 404677d221ca4..ce0b4443d080f 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceAliases.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceAliases.h
@@ -17,8 +17,8 @@
#include "Delta.h"
namespace llvm {
-void reduceAliasesDeltaPass(TestRunner &Test);
-void reduceIFuncsDeltaPass(TestRunner &Test);
+void reduceAliasesDeltaPass(Oracle &O, ReducerWorkItem &Program);
+void reduceIFuncsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp b/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
index b16f512ff6166..8622de9aa121e 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceArguments.h"
-#include "Delta.h"
#include "Utils.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Constants.h"
@@ -112,7 +111,7 @@ static bool allFuncUsersRewritable(const Function &F) {
/// Removes out-of-chunk arguments from functions, and modifies their calls
/// accordingly. It also removes allocations of out-of-chunk arguments.
-static void extractArgumentsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceArgumentsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
std::vector<Argument *> InitArgsToKeep;
std::vector<Function *> Funcs;
@@ -176,8 +175,4 @@ static void extractArgumentsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
F->replaceAllUsesWith(ClonedFunc);
F->eraseFromParent();
}
-}
-
-void llvm::reduceArgumentsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractArgumentsFromModule, "Reducing Arguments");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceArguments.h b/llvm/tools/llvm-reduce/deltas/ReduceArguments.h
index 5adcfe89266bc..cd305451a5713 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceArguments.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceArguments.h
@@ -20,7 +20,7 @@
#include "llvm/Transforms/Utils/Cloning.h"
namespace llvm {
-void reduceArgumentsDeltaPass(TestRunner &Test);
+void reduceArgumentsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
index 1f497089e18fc..f0f6ef0837985 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceAttributes.h"
-#include "Delta.h"
#include "TestRunner.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
@@ -166,11 +165,7 @@ class AttributeRemapper : public InstVisitor<AttributeRemapper> {
} // namespace
/// Removes out-of-chunk attributes from module.
-static void extractAttributesFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
- AttributeRemapper R(O, WorkItem.getModule());
+void llvm::reduceAttributesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
+ AttributeRemapper R(O, WorkItem.getContext());
R.visit(WorkItem.getModule());
}
-
-void llvm::reduceAttributesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractAttributesFromModule, "Reducing Attributes");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h
index a2e9955ac5bb4..663f6d8c23a3b 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h
@@ -14,9 +14,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEATTRIBUTES_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEATTRIBUTES_H
+#include "Delta.h"
+
namespace llvm {
-class TestRunner;
-void reduceAttributesDeltaPass(TestRunner &Test);
+void reduceAttributesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp b/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
index da363df77d0c0..5656fdda764a4 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
@@ -23,8 +23,8 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
+#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
-
#include <vector>
#define DEBUG_TYPE "llvm-reduce"
@@ -141,7 +141,7 @@ removeUninterestingBBsFromSwitch(SwitchInst &SwInst,
/// Removes out-of-chunk arguments from functions, and modifies their calls
/// accordingly. It also removes allocations of out-of-chunk arguments.
-static void extractBasicBlocksFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceBasicBlocksDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
DenseSet<BasicBlock *> BBsToDelete;
df_iterator_default_set<BasicBlock *> Reachable;
@@ -188,12 +188,8 @@ static void extractBasicBlocksFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
-void llvm::reduceBasicBlocksDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractBasicBlocksFromModule, "Reducing Basic Blocks");
-}
-
-static void removeUnreachableBasicBlocksFromModule(Oracle &O,
- ReducerWorkItem &WorkItem) {
+void llvm::reduceUnreachableBasicBlocksDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
std::vector<BasicBlock *> DeadBlocks;
df_iterator_default_set<BasicBlock *> Reachable;
@@ -219,8 +215,3 @@ static void removeUnreachableBasicBlocksFromModule(Oracle &O,
Reachable.clear();
}
}
-
-void llvm::reduceUnreachableBasicBlocksDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, removeUnreachableBasicBlocksFromModule,
- "Removing Unreachable Basic Blocks");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.h b/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.h
index a090d675ef822..b7a3b2867ae35 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.h
@@ -14,12 +14,11 @@
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEBASICBLOCKS_H
#include "Delta.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
-#include "llvm/Transforms/Utils/Cloning.h"
namespace llvm {
-void reduceBasicBlocksDeltaPass(TestRunner &Test);
-void reduceUnreachableBasicBlocksDeltaPass(TestRunner &Test);
+void reduceBasicBlocksDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceUnreachableBasicBlocksDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
index 9dcf722fd1d90..404a09b9d07ea 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceDIMetadata.h"
-#include "Delta.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
@@ -76,7 +75,7 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
}
}
-static void extractDIMetadataFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceDIMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
MDNodeList MDs;
@@ -93,8 +92,4 @@ static void extractDIMetadataFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
MDs.push_back(DI);
}
identifyUninterestingMDNodes(O, MDs);
-}
-
-void llvm::reduceDIMetadataDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractDIMetadataFromModule, "Reducing DIMetadata");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.h b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.h
index 379c14a0db200..d9976fc3a2902 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.h
@@ -14,10 +14,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEDIMETADATA_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEDIMETADATA_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceDIMetadataDeltaPass(TestRunner &Test);
+void reduceDIMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
index 25de659109c9f..b43a7c999b162 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
@@ -20,10 +20,12 @@
#include "ReduceDbgRecords.h"
#include "Utils.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/DebugProgramInstruction.h"
using namespace llvm;
-static void extractDbgRecordsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceDbgRecordDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &M = WorkItem.getModule();
for (auto &F : M)
@@ -32,8 +34,4 @@ static void extractDbgRecordsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
for (DbgRecord &DR : llvm::make_early_inc_range(I.getDbgRecordRange()))
if (!O.shouldKeep())
DR.eraseFromParent();
-}
-
-void llvm::reduceDbgRecordDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractDbgRecordsFromModule, "Reducing DbgRecords");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h
index 07a1e04fceaee..a122465e2a628 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h
@@ -15,11 +15,9 @@
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEDBGRECORDS_H
#include "Delta.h"
-#include "llvm/IR/BasicBlock.h"
-#include "llvm/IR/DebugProgramInstruction.h"
namespace llvm {
-void reduceDbgRecordDeltaPass(TestRunner &Test);
+void reduceDbgRecordDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp
index 0f46409977a33..dc8ebf61d3180 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceDistinctMetadata.h"
-#include "Delta.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
@@ -118,8 +117,8 @@ static void cleanUpTemporaries(NamedMDNode &NamedNode, MDTuple *TemporaryTuple,
}
}
-static void extractDistinctMetadataFromModule(Oracle &O,
- ReducerWorkItem &WorkItem) {
+void llvm::reduceDistinctMetadataDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
MDTuple *TemporaryTuple =
MDTuple::getDistinct(Program.getContext(), SmallVector<Metadata *, 1>{});
@@ -134,9 +133,4 @@ static void extractDistinctMetadataFromModule(Oracle &O,
}
for (NamedMDNode &NamedNode : Program.named_metadata())
cleanUpTemporaries(NamedNode, TemporaryTuple, Program);
-}
-
-void llvm::reduceDistinctMetadataDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractDistinctMetadataFromModule,
- "Reducing Distinct Metadata");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.h b/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.h
index d02e8e6107b75..e7a817c173b07 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.h
@@ -14,10 +14,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEDISTINCTMETADATA_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEDISTINCTMETADATA_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceDistinctMetadataDeltaPass(TestRunner &Test);
+void reduceDistinctMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp b/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
index 21875ba00cf8b..af0ff996a1c13 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceFunctionBodies.h"
-#include "Delta.h"
#include "Utils.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Instructions.h"
@@ -21,8 +20,7 @@ using namespace llvm;
/// Removes all the bodies of defined functions that aren't inside any of the
/// desired Chunks.
-static void extractFunctionBodiesFromModule(Oracle &O,
- ReducerWorkItem &WorkItem) {
+void llvm::reduceFunctionBodiesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
// Delete out-of-chunk function bodies
for (auto &F : WorkItem.getModule()) {
if (!F.isDeclaration() && !hasAliasUse(F) && !O.shouldKeep()) {
@@ -32,12 +30,7 @@ static void extractFunctionBodiesFromModule(Oracle &O,
}
}
-void llvm::reduceFunctionBodiesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractFunctionBodiesFromModule,
- "Reducing Function Bodies");
-}
-
-static void reduceFunctionData(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceFunctionDataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
for (Function &F : WorkItem.getModule()) {
if (F.hasPersonalityFn()) {
if (none_of(F,
@@ -56,7 +49,3 @@ static void reduceFunctionData(Oracle &O, ReducerWorkItem &WorkItem) {
F.setPrologueData(nullptr);
}
}
-
-void llvm::reduceFunctionDataDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceFunctionData, "Reducing Function Data");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.h b/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.h
index ae738fb1b88e3..720fb6eb26654 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.h
@@ -17,8 +17,8 @@
#include "Delta.h"
namespace llvm {
-void reduceFunctionBodiesDeltaPass(TestRunner &Test);
-void reduceFunctionDataDeltaPass(TestRunner &Test);
+void reduceFunctionBodiesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceFunctionDataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
index 619811c89202e..bb0e702ef5ec3 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
@@ -13,9 +13,9 @@
//===----------------------------------------------------------------------===//
#include "ReduceFunctions.h"
-#include "Delta.h"
#include "Utils.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <iterator>
@@ -23,7 +23,7 @@ using namespace llvm;
/// Removes all the Defined Functions
/// that aren't inside any of the desired Chunks.
-static void extractFunctionsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceFunctionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
// Record all out-of-chunk functions.
@@ -53,8 +53,4 @@ static void extractFunctionsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
// And finally, fully drop it.
cast<Function>(F)->eraseFromParent();
}
-}
-
-void llvm::reduceFunctionsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractFunctionsFromModule, "Reducing Functions");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.h b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.h
index d3ff0d9511289..6f4e61c8c1e86 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.h
@@ -15,10 +15,9 @@
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEFUNCTIONS_H
#include "Delta.h"
-#include "llvm/Transforms/Utils/Cloning.h"
namespace llvm {
-void reduceFunctionsDeltaPass(TestRunner &Test);
+void reduceFunctionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
index 1d1463a055bd8..b238fb652d594 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
@@ -19,7 +19,7 @@ static bool shouldReduceAlign(GlobalObject &GO) {
static bool shouldReduceComdat(GlobalObject &GO) { return GO.hasComdat(); }
-static void reduceGOs(Oracle &O, ReducerWorkItem &Program) {
+void llvm::reduceGlobalObjectsDeltaPass(Oracle &O, ReducerWorkItem &Program) {
for (auto &GO : Program.getModule().global_objects()) {
if (shouldReduceSection(GO) && !O.shouldKeep())
GO.setSection("");
@@ -28,8 +28,4 @@ static void reduceGOs(Oracle &O, ReducerWorkItem &Program) {
if (shouldReduceComdat(GO) && !O.shouldKeep())
GO.setComdat(nullptr);
}
-}
-
-void llvm::reduceGlobalObjectsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceGOs, "Reducing GlobalObjects");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.h b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.h
index 35c38a9ecf212..bca061e3b02cb 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void reduceGlobalObjectsDeltaPass(TestRunner &Test);
+void reduceGlobalObjectsDeltaPass(Oracle &O, ReducerWorkItem &Program);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp
index 6e8c21008502f..31c255f7539b0 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp
@@ -41,7 +41,7 @@ static bool shouldReduceLinkage(GlobalValue &GV) {
return !GV.hasExternalLinkage() && !GV.hasAppendingLinkage();
}
-static void reduceGVs(Oracle &O, ReducerWorkItem &Program) {
+void llvm::reduceGlobalValuesDeltaPass(Oracle &O, ReducerWorkItem &Program) {
for (auto &GV : Program.getModule().global_values()) {
if (shouldReduceDSOLocal(GV) && !O.shouldKeep())
GV.setDSOLocal(false);
@@ -65,8 +65,4 @@ static void reduceGVs(Oracle &O, ReducerWorkItem &Program) {
GV.setDSOLocal(false);
}
}
-}
-
-void llvm::reduceGlobalValuesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceGVs, "Reducing GlobalValues");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.h b/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.h
index 19c0707936528..f7dbc90543156 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.h
@@ -17,7 +17,7 @@
#include "Delta.h"
namespace llvm {
-void reduceGlobalValuesDeltaPass(TestRunner &Test);
+void reduceGlobalValuesDeltaPass(Oracle &O, ReducerWorkItem &Program);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
index 4c7125217f252..88f96dc5a6466 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
@@ -14,11 +14,14 @@
#include "ReduceGlobalVarInitializers.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Transforms/Utils/Cloning.h"
using namespace llvm;
/// Removes all the Initialized GVs that aren't inside the desired Chunks.
-static void extractGVsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceGlobalsInitializersDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
// Drop initializers of out-of-chunk GVs
for (auto &GV : WorkItem.getModule().globals())
if (GV.hasInitializer() && !O.shouldKeep()) {
@@ -26,8 +29,4 @@ static void extractGVsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
GV.setLinkage(GlobalValue::LinkageTypes::ExternalLinkage);
GV.setComdat(nullptr);
}
-}
-
-void llvm::reduceGlobalsInitializersDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractGVsFromModule, "Reducing GV Initializers");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.h b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.h
index 318b29b6ca5e4..b3cb075346897 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.h
@@ -15,11 +15,9 @@
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEGLOBALVARINITIALIZERS_H
#include "Delta.h"
-#include "llvm/IR/Value.h"
-#include "llvm/Transforms/Utils/Cloning.h"
namespace llvm {
-void reduceGlobalsInitializersDeltaPass(TestRunner &Test);
+void reduceGlobalsInitializersDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp
index b448081ee1a27..e20f009a254d5 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp
@@ -14,6 +14,8 @@
#include "ReduceGlobalVars.h"
#include "Utils.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
using namespace llvm;
@@ -23,7 +25,7 @@ static bool shouldAlwaysKeep(const GlobalVariable &GV) {
}
/// Removes all the GVs that aren't inside the desired Chunks.
-static void extractGVsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceGlobalsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
// Get GVs inside desired chunks
@@ -52,8 +54,4 @@ static void extractGVsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
GV->replaceAllUsesWith(getDefaultValue(GV->getType()));
cast<GlobalVariable>(GV)->eraseFromParent();
}
-}
-
-void llvm::reduceGlobalsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractGVsFromModule, "Reducing GlobalVariables");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.h b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.h
index 1198dceb45368..eb1a65f2043a9 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.h
@@ -15,11 +15,9 @@
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEGLOBALVARS_H
#include "Delta.h"
-#include "llvm/IR/Value.h"
-#include "llvm/Transforms/Utils/Cloning.h"
namespace llvm {
-void reduceGlobalsDeltaPass(TestRunner &Test);
+void reduceGlobalsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp b/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp
index 4bb1eb7db1d09..3703b403e7c78 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp
@@ -13,7 +13,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceIRReferences.h"
-#include "Delta.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
@@ -37,14 +36,16 @@ static void dropIRReferencesFromInstructions(Oracle &O, MachineFunction &MF) {
}
}
-static void stripIRFromInstructions(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceIRInstructionReferencesDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
dropIRReferencesFromInstructions(O, *MF);
}
}
-static void stripIRFromBlocks(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceIRBlockReferencesDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F)) {
for (MachineBasicBlock &MBB : *MF) {
@@ -55,7 +56,8 @@ static void stripIRFromBlocks(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
-static void stripIRFromFunctions(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceIRFunctionReferencesDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (!O.shouldKeep()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F)) {
@@ -66,18 +68,4 @@ static void stripIRFromFunctions(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
-
-void llvm::reduceIRInstructionReferencesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, stripIRFromInstructions,
- "Reducing IR references from instructions");
-}
-
-void llvm::reduceIRBlockReferencesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, stripIRFromBlocks, "Reducing IR references from blocks");
-}
-
-void llvm::reduceIRFunctionReferencesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, stripIRFromFunctions,
- "Reducing IR references from functions");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.h b/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.h
index 548559a0775b4..4394602911df1 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.h
@@ -14,17 +14,19 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEIRREFERENCES_MIR_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEIRREFERENCES_MIR_H
+#include "Delta.h"
+
namespace llvm {
-class TestRunner;
/// Remove IR references from instructions (i.e. from memory operands)
-void reduceIRInstructionReferencesDeltaPass(TestRunner &Test);
+void reduceIRInstructionReferencesDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem);
/// Remove IR BasicBlock references (the block names)
-void reduceIRBlockReferencesDeltaPass(TestRunner &Test);
+void reduceIRBlockReferencesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
/// Remove IR references from function level fields (e.g. frame object names)
-void reduceIRFunctionReferencesDeltaPass(TestRunner &Test);
+void reduceIRFunctionReferencesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
index e157747004782..1b66d602674a2 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceInstructionFlags.h"
-#include "Delta.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
@@ -19,7 +18,8 @@
using namespace llvm;
-static void reduceFlagsInModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceInstructionFlagsDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
// Keep this in sync with computeIRComplexityScoreImpl().
for (Function &F : WorkItem.getModule()) {
for (Instruction &I : instructions(F)) {
@@ -82,8 +82,4 @@ static void reduceFlagsInModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
-
-void llvm::reduceInstructionFlagsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceFlagsInModule, "Reducing Instruction Flags");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.h b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.h
index 1764c0199da87..005cc8390ab96 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.h
@@ -9,10 +9,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINSTRUCTIONFLAGS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINSTRUCTIONFLAGS_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceInstructionFlagsDeltaPass(TestRunner &Test);
+void reduceInstructionFlagsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp
index f2895b31947ec..60f8e6527047d 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp
@@ -14,9 +14,11 @@
#include "ReduceInstructionFlagsMIR.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
+
using namespace llvm;
-static void removeFlagsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceInstructionFlagsMIRDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F)) {
for (MachineBasicBlock &MBB : *MF) {
@@ -28,8 +30,4 @@ static void removeFlagsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
-
-void llvm::reduceInstructionFlagsMIRDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, removeFlagsFromModule, "Reducing Instruction Flags");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.h b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.h
index a5a34d275e2f0..77d8eea12a2d6 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.h
@@ -17,7 +17,7 @@
#include "Delta.h"
namespace llvm {
-void reduceInstructionFlagsMIRDeltaPass(TestRunner &Test);
+void reduceInstructionFlagsMIRDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
index e1b7924594b5e..a906584f75dd7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
@@ -14,6 +14,8 @@
#include "ReduceInstructions.h"
#include "Utils.h"
#include "llvm/IR/Constants.h"
+#include "llvm/Transforms/Utils/BasicBlockUtils.h"
+#include "llvm/Transforms/Utils/Cloning.h"
#include <set>
using namespace llvm;
@@ -29,7 +31,7 @@ static bool shouldAlwaysKeep(const Instruction &I) {
/// Removes out-of-chunk arguments from functions, and modifies their calls
/// accordingly. It also removes allocations of out-of-chunk arguments.
-static void extractInstrFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceInstructionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
for (auto &F : Program) {
@@ -46,7 +48,3 @@ static void extractInstrFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-
-void llvm::reduceInstructionsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractInstrFromModule, "Reducing Instructions");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.h b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.h
index 8c13a02cb98f3..ca3b7d521ce77 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.h
@@ -15,11 +15,9 @@
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINSTRUCTIONS_H
#include "Delta.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
-#include "llvm/Transforms/Utils/Cloning.h"
namespace llvm {
-void reduceInstructionsDeltaPass(TestRunner &Test);
+void reduceInstructionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
index 40bc6b180fb88..b4df24c5420ec 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
@@ -12,8 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceInstructionsMIR.h"
-#include "Delta.h"
-
#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -151,13 +149,10 @@ static void extractInstrFromFunction(Oracle &O, MachineFunction &MF) {
MI->eraseFromParent();
}
-static void extractInstrFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceInstructionsMIRDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (MachineFunction *MF = WorkItem.MMI->getMachineFunction(F))
extractInstrFromFunction(O, *MF);
}
-}
-
-void llvm::reduceInstructionsMIRDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractInstrFromModule, "Reducing Instructions");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.h b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.h
index 70e0ac5fcf37f..e07f5636b6c8b 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.h
@@ -14,10 +14,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINSTRUCTIONS_MIR_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINSTRUCTIONS_MIR_H
-namespace llvm {
-class TestRunner;
+#include "Delta.h"
-void reduceInstructionsMIRDeltaPass(TestRunner &Test);
+namespace llvm {
+void reduceInstructionsMIRDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp
index c6425a753df54..5cb92fb72d34f 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceInvokes.h"
-#include "Delta.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Transforms/Utils/Local.h"
@@ -29,13 +28,9 @@ static void reduceInvokesInFunction(Oracle &O, Function &F) {
// reduction.
}
-static void reduceInvokesInModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceInvokesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
for (Function &F : WorkItem.getModule()) {
if (F.hasPersonalityFn())
reduceInvokesInFunction(O, F);
}
-}
-
-void llvm::reduceInvokesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceInvokesInModule, "Reducing Invokes");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInvokes.h b/llvm/tools/llvm-reduce/deltas/ReduceInvokes.h
index 9607add166005..4d246c22e6220 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInvokes.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInvokes.h
@@ -9,10 +9,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINVOKES_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEINVOKES_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceInvokesDeltaPass(TestRunner &Test);
+void reduceInvokesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp b/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp
index 8e73ea076034c..c6c5474df52dc 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceMemoryOperations.h"
-#include "Delta.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
@@ -36,14 +35,16 @@ static void removeVolatileInFunction(Oracle &O, Function &F) {
}
}
-static void removeVolatileInModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceVolatileInstructionsDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (Function &F : WorkItem.getModule())
removeVolatileInFunction(O, F);
}
-void llvm::reduceVolatileInstructionsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, removeVolatileInModule, "Reducing Volatile Instructions");
-}
+// void llvm::reduceVolatileInstructionsDeltaPass(TestRunner &Test, StringRef
+// PassMessage) {
+// runDeltaPass(Test, removeVolatileInModule, PassMessage);
+// }
static void reduceAtomicSyncScopesInFunction(Oracle &O, Function &F) {
for (Instruction &I : instructions(F)) {
@@ -66,17 +67,12 @@ static void reduceAtomicSyncScopesInFunction(Oracle &O, Function &F) {
}
}
-static void reduceAtomicSyncScopesInModule(Oracle &O,
+void llvm::reduceAtomicSyncScopesDeltaPass(Oracle &O,
ReducerWorkItem &WorkItem) {
for (Function &F : WorkItem.getModule())
reduceAtomicSyncScopesInFunction(O, F);
}
-void llvm::reduceAtomicSyncScopesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceAtomicSyncScopesInModule,
- "Reducing Atomic Sync Scopes");
-}
-
// TODO: Might be helpful to incrementally relax orders
static void reduceAtomicOrderingInFunction(Oracle &O, Function &F) {
for (Instruction &I : instructions(F)) {
@@ -100,11 +96,7 @@ static void reduceAtomicOrderingInFunction(Oracle &O, Function &F) {
}
}
-static void reduceAtomicOrderingInModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceAtomicOrderingDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
for (Function &F : WorkItem.getModule())
reduceAtomicOrderingInFunction(O, F);
}
-
-void llvm::reduceAtomicOrderingDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceAtomicOrderingInModule, "Reducing Atomic Ordering");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.h b/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.h
index ca6a770dff081..46ada3661e31d 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.h
@@ -9,12 +9,12 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEMEMORYOPERATIONS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEMEMORYOPERATIONS_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceVolatileInstructionsDeltaPass(TestRunner &Test);
-void reduceAtomicSyncScopesDeltaPass(TestRunner &Test);
-void reduceAtomicOrderingDeltaPass(TestRunner &Test);
+void reduceVolatileInstructionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceAtomicSyncScopesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceAtomicOrderingDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
index 316c74876025a..f22f0be3805e3 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceMetadata.h"
-#include "Delta.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/InstIterator.h"
@@ -48,7 +47,7 @@ static constexpr StringLiteral ListNamedMetadata[] = {
};
/// Remove unneeded arguments to named metadata.
-static void reduceNamedMetadataOperands(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceNamedMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &M = WorkItem.getModule();
for (NamedMDNode &I : M.named_metadata()) {
@@ -77,7 +76,7 @@ static void reduceNamedMetadataOperands(Oracle &O, ReducerWorkItem &WorkItem) {
/// Removes all the Named and Unnamed Metadata Nodes, as well as any debug
/// functions that aren't inside the desired Chunks.
-static void extractMetadataFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
// Get out-of-chunk Named metadata nodes
@@ -121,12 +120,4 @@ static void extractMetadataFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
-
-void llvm::reduceMetadataDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractMetadataFromModule, "Reducing Metadata");
-}
-
-void llvm::reduceNamedMetadataDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceNamedMetadataOperands, "Reducing Named Metadata");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceMetadata.h b/llvm/tools/llvm-reduce/deltas/ReduceMetadata.h
index f3af31a2759bc..34bf2feb92f74 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceMetadata.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceMetadata.h
@@ -14,11 +14,11 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEMETADATA_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEMETADATA_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceMetadataDeltaPass(TestRunner &Test);
-void reduceNamedMetadataDeltaPass(TestRunner &Test);
+void reduceMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceNamedMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp b/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp
index 17930abe6dbfe..695bee1cb0f6f 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp
@@ -14,7 +14,7 @@
using namespace llvm;
-static void clearModuleData(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceModuleDataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
if (!Program.getModuleIdentifier().empty() && !O.shouldKeep())
@@ -24,8 +24,4 @@ static void clearModuleData(Oracle &O, ReducerWorkItem &WorkItem) {
// TODO: clear line by line rather than all at once
if (!Program.getModuleInlineAsm().empty() && !O.shouldKeep())
Program.setModuleInlineAsm("");
-}
-
-void llvm::reduceModuleDataDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, clearModuleData, "Reducing Module Data");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceModuleData.h b/llvm/tools/llvm-reduce/deltas/ReduceModuleData.h
index 960fe8c6d3a6d..a5eaab9f9c59c 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceModuleData.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceModuleData.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void reduceModuleDataDeltaPass(TestRunner &Test);
+void reduceModuleDataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp
index 9fb4fd61c74e7..62cf40987f2e3 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceOpcodes.h"
-#include "Delta.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
@@ -240,7 +239,7 @@ static Value *reduceInstruction(Oracle &O, Module &M, Instruction &I) {
return nullptr;
}
-static void replaceOpcodesInModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceOpcodesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Mod = WorkItem.getModule();
for (Function &F : Mod) {
@@ -260,8 +259,4 @@ static void replaceOpcodesInModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
-
-void llvm::reduceOpcodesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, replaceOpcodesInModule, "Reducing Opcodes");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.h b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.h
index 79edc7f32facf..5861c2571a1bd 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.h
@@ -9,10 +9,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEOPCODES_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEOPCODES_H
-#include "TestRunner.h"
+#include "Delta.h"
namespace llvm {
-void reduceOpcodesDeltaPass(TestRunner &Test);
+void reduceOpcodesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
index d2274877f126b..5ba02104e9235 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceOperandBundles.h"
-#include "Delta.h"
#include "TestRunner.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
@@ -95,17 +94,11 @@ static void maybeRewriteCallWithDifferentBundles(
}
/// Removes out-of-chunk operand bundles from calls.
-static void extractOperandBundesFromModule(Oracle &O,
- ReducerWorkItem &WorkItem) {
+void llvm::reduceOperandBundesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
OperandBundleRemapper R(O);
R.visit(Program);
for (const auto &I : R.CallsToRefine)
maybeRewriteCallWithDifferentBundles(I.first, I.second);
-}
-
-void llvm::reduceOperandBundesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractOperandBundesFromModule,
- "Reducing Operand Bundles");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.h b/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.h
index 390b029242536..23af510f7f31c 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.h
@@ -14,9 +14,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEOPERANDBUNDLES_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEOPERANDBUNDLES_H
+#include "Delta.h"
+
namespace llvm {
-class TestRunner;
-void reduceOperandBundesDeltaPass(TestRunner &Test);
+void reduceOperandBundesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
index 5babdc7d0a940..ace56f97096d7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
@@ -83,7 +83,7 @@ static bool switchCaseExists(Use &Op, ConstantInt *CI) {
return SI->findCaseValue(CI) != SI->case_default();
}
-void llvm::reduceOperandsOneDeltaPass(TestRunner &Test) {
+void llvm::reduceOperandsOneDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
auto ReduceValue = [](Use &Op) -> Value * {
if (!shouldReduceOperand(Op))
return nullptr;
@@ -118,15 +118,10 @@ void llvm::reduceOperandsOneDeltaPass(TestRunner &Test) {
return nullptr;
};
- runDeltaPass(
- Test,
- [ReduceValue](Oracle &O, ReducerWorkItem &WorkItem) {
- extractOperandsFromModule(O, WorkItem, ReduceValue);
- },
- "Reducing Operands to one");
+ extractOperandsFromModule(O, WorkItem, ReduceValue);
}
-void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
+void llvm::reduceOperandsZeroDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
auto ReduceValue = [](Use &Op) -> Value * {
if (!shouldReduceOperand(Op))
return nullptr;
@@ -148,15 +143,10 @@ void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
// Don't replace existing zeroes.
return isZero(Op) ? nullptr : Constant::getNullValue(Op->getType());
};
- runDeltaPass(
- Test,
- [ReduceValue](Oracle &O, ReducerWorkItem &Program) {
- extractOperandsFromModule(O, Program, ReduceValue);
- },
- "Reducing Operands to zero");
+ extractOperandsFromModule(O, WorkItem, ReduceValue);
}
-void llvm::reduceOperandsNaNDeltaPass(TestRunner &Test) {
+void llvm::reduceOperandsNaNDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
auto ReduceValue = [](Use &Op) -> Value * {
Type *Ty = Op->getType();
if (!Ty->isFPOrFPVectorTy())
@@ -176,10 +166,5 @@ void llvm::reduceOperandsNaNDeltaPass(TestRunner &Test) {
return ConstantFP::getQNaN(Ty);
};
- runDeltaPass(
- Test,
- [ReduceValue](Oracle &O, ReducerWorkItem &Program) {
- extractOperandsFromModule(O, Program, ReduceValue);
- },
- "Reducing Operands to NaN");
-}
+ extractOperandsFromModule(O, WorkItem, ReduceValue);
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.h b/llvm/tools/llvm-reduce/deltas/ReduceOperands.h
index b4a18998f8e20..2c86ba920442b 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.h
@@ -12,9 +12,9 @@
#include "Delta.h"
namespace llvm {
-void reduceOperandsOneDeltaPass(TestRunner &Test);
-void reduceOperandsZeroDeltaPass(TestRunner &Test);
-void reduceOperandsNaNDeltaPass(TestRunner &Test);
+void reduceOperandsOneDeltaPass(Oracle &, ReducerWorkItem &);
+void reduceOperandsZeroDeltaPass(Oracle &, ReducerWorkItem &);
+void reduceOperandsNaNDeltaPass(Oracle &, ReducerWorkItem &);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
index 2a9d40d8c3c59..cd9e789ba90a3 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
@@ -194,7 +194,7 @@ opportunities(Function &F,
}
}
-static void extractOperandsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceOperandsSkipDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
for (Function &F : Program.functions()) {
@@ -228,9 +228,4 @@ static void extractOperandsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
P.first->set(P.second);
}
}
-}
-
-void llvm::reduceOperandsSkipDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractOperandsFromModule,
- "Reducing operands by skipping over instructions");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.h b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.h
index 79897011639a2..71047110701fa 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void reduceOperandsSkipDeltaPass(TestRunner &Test);
+void reduceOperandsSkipDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif /* LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEOPERANDSSKIP_H */
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
index 32bceb74afa70..6f1052a11b973 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceOperandsToArgs.h"
-#include "Delta.h"
#include "Utils.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/IR/Constants.h"
@@ -189,7 +188,7 @@ static void substituteOperandWithArgument(Function *OldF,
OldF->eraseFromParent();
}
-static void reduceOperandsToArgs(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceOperandsToArgsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
SmallVector<Use *> OperandsToReduce;
@@ -210,9 +209,4 @@ static void reduceOperandsToArgs(Oracle &O, ReducerWorkItem &WorkItem) {
substituteOperandWithArgument(&F, OperandsToReduce);
}
-}
-
-void llvm::reduceOperandsToArgsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceOperandsToArgs,
- "Converting operands to function arguments");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.h b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.h
index 23043dd60b6ff..5d6e47c56059b 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void reduceOperandsToArgsDeltaPass(TestRunner &Test);
+void reduceOperandsToArgsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif /* LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEOPERANDSTOARGS_H */
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp
index 97259649ab858..244ac79423583 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp
@@ -110,13 +110,10 @@ static void removeDefsFromFunction(Oracle &O, MachineFunction &MF) {
}
}
-static void removeDefsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceRegisterDefsMIRDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
removeDefsFromFunction(O, *MF);
}
-}
-
-void llvm::reduceRegisterDefsMIRDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, removeDefsFromModule, "Reducing register defs");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.h b/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.h
index 031d24125bac8..88ea024722ebc 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.h
@@ -17,7 +17,7 @@
#include "Delta.h"
namespace llvm {
-void reduceRegisterDefsMIRDeltaPass(TestRunner &Test);
+void reduceRegisterDefsMIRDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp b/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp
index 953e0e51afd82..5702d5c04f707 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp
@@ -60,13 +60,10 @@ static void reduceMasksInFunction(Oracle &O, MachineFunction &MF) {
}
}
-static void reduceMasksInModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceRegisterMasksMIRDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
reduceMasksInFunction(O, *MF);
}
-}
-
-void llvm::reduceRegisterMasksMIRDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceMasksInModule, "Reducing register masks");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.h b/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.h
index b8bb109e5c996..aee82a7c89214 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void reduceRegisterMasksMIRDeltaPass(TestRunner &Test);
+void reduceRegisterMasksMIRDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp b/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp
index a608935736d1a..655764d643779 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp
@@ -55,13 +55,10 @@ static void removeUsesFromFunction(Oracle &O, MachineFunction &MF) {
}
}
-static void removeUsesFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceRegisterUsesMIRDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
removeUsesFromFunction(O, *MF);
}
-}
-
-void llvm::reduceRegisterUsesMIRDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, removeUsesFromModule, "Reducing register uses");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.h b/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.h
index 91ecba488f37c..40f6fcdb694af 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.h
@@ -17,7 +17,7 @@
#include "Delta.h"
namespace llvm {
-void reduceRegisterUsesMIRDeltaPass(TestRunner &Test);
+void reduceRegisterUsesMIRDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp b/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
index aadd038033d5c..802e349633bfb 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
@@ -15,7 +15,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceSpecialGlobals.h"
-#include "Delta.h"
#include "Utils.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Constants.h"
@@ -27,8 +26,7 @@ static StringRef SpecialGlobalNames[] = {"llvm.used", "llvm.compiler.used"};
/// Removes all special globals aren't inside any of the
/// desired Chunks.
-static void extractSpecialGlobalsFromModule(Oracle &O,
- ReducerWorkItem &WorkItem) {
+void llvm::reduceSpecialGlobalsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
for (StringRef Name : SpecialGlobalNames) {
@@ -39,9 +37,4 @@ static void extractSpecialGlobalsFromModule(Oracle &O,
}
}
}
-}
-
-void llvm::reduceSpecialGlobalsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractSpecialGlobalsFromModule,
- "Reducing Special Globals");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.h b/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.h
index d17790529e06b..8332a2102df97 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.h
@@ -20,7 +20,7 @@
#include "Delta.h"
namespace llvm {
-void reduceSpecialGlobalsDeltaPass(TestRunner &Test);
+void reduceSpecialGlobalsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp b/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
index c49fcb9855d41..10e750584bc66 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
@@ -19,7 +19,8 @@
using namespace llvm;
-static void reduceUsingSimplifyCFG(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::reduceUsingSimplifyCFGDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
SmallVector<BasicBlock *, 16> ToSimplify;
for (auto &F : Program)
@@ -31,9 +32,6 @@ static void reduceUsingSimplifyCFG(Oracle &O, ReducerWorkItem &WorkItem) {
simplifyCFG(BB, TTI);
}
-void llvm::reduceUsingSimplifyCFGDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, reduceUsingSimplifyCFG, "Reducing using SimplifyCFG");
-}
static void reduceConditionals(Oracle &O, ReducerWorkItem &WorkItem,
bool Direction) {
Module &M = WorkItem.getModule();
@@ -59,20 +57,12 @@ static void reduceConditionals(Oracle &O, ReducerWorkItem &WorkItem,
simplifyCFG(BB, TTI);
}
-void llvm::reduceConditionalsTrueDeltaPass(TestRunner &Test) {
- runDeltaPass(
- Test,
- [](Oracle &O, ReducerWorkItem &WorkItem) {
- reduceConditionals(O, WorkItem, true);
- },
- "Reducing conditional branches to true");
+void llvm::reduceConditionalsTrueDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
+ reduceConditionals(O, WorkItem, true);
}
-void llvm::reduceConditionalsFalseDeltaPass(TestRunner &Test) {
- runDeltaPass(
- Test,
- [](Oracle &O, ReducerWorkItem &WorkItem) {
- reduceConditionals(O, WorkItem, false);
- },
- "Reducing conditional branches to false");
-}
+void llvm::reduceConditionalsFalseDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
+ reduceConditionals(O, WorkItem, false);
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.h b/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.h
index 01a14602909b3..48dce275574e9 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.h
@@ -17,9 +17,9 @@
#include "Delta.h"
namespace llvm {
-void reduceUsingSimplifyCFGDeltaPass(TestRunner &Test);
-void reduceConditionalsTrueDeltaPass(TestRunner &Test);
-void reduceConditionalsFalseDeltaPass(TestRunner &Test);
+void reduceUsingSimplifyCFGDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceConditionalsTrueDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
+void reduceConditionalsFalseDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp b/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp
index 3ec9555c0f2f5..8ebdb2bd948bf 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "ReduceVirtualRegisters.h"
-#include "Delta.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
@@ -33,15 +32,10 @@ static void dropRegisterHintsFromFunction(Oracle &O, MachineFunction &MF) {
}
}
-static void dropRegisterHintsFromFunctions(Oracle &O,
- ReducerWorkItem &WorkItem) {
+void llvm::reduceVirtualRegisterHintsDeltaPass(Oracle &O,
+ ReducerWorkItem &WorkItem) {
for (const Function &F : WorkItem.getModule()) {
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
dropRegisterHintsFromFunction(O, *MF);
}
-}
-
-void llvm::reduceVirtualRegisterHintsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, dropRegisterHintsFromFunctions,
- "Reducing virtual register hints from functions");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.h b/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.h
index 405ba31703e54..ff8ba4a004f34 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.h
@@ -14,11 +14,13 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEVIRTUALREGISTERS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEVIRTUALREGISTERS_H
+#include "Delta.h"
+
namespace llvm {
class TestRunner;
/// Remove register allocation hints from virtual registes.
-void reduceVirtualRegisterHintsDeltaPass(TestRunner &Test);
+void reduceVirtualRegisterHintsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
diff --git a/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp b/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp
index e3af05616fe04..1cb743c662c6c 100644
--- a/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp
+++ b/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "RunIRPasses.h"
-#include "Delta.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
@@ -24,7 +23,7 @@ static cl::opt<std::string>
"simplifycfg,infer-address-spaces)"),
cl::cat(LLVMReduceOptions));
-static void runPasses(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::runIRPassesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
LoopAnalysisManager LAM;
FunctionAnalysisManager FAM;
@@ -48,8 +47,4 @@ static void runPasses(Oracle &O, ReducerWorkItem &WorkItem) {
report_fatal_error("Error constructing pass pipeline");
}
MPM.run(Program, MAM);
-}
-
-void llvm::runIRPassesDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, runPasses, "Running passes");
-}
+}
\ No newline at end of file
diff --git a/llvm/tools/llvm-reduce/deltas/RunIRPasses.h b/llvm/tools/llvm-reduce/deltas/RunIRPasses.h
index f1d4140d5b57f..bd7dd8adf1d89 100644
--- a/llvm/tools/llvm-reduce/deltas/RunIRPasses.h
+++ b/llvm/tools/llvm-reduce/deltas/RunIRPasses.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void runIRPassesDeltaPass(TestRunner &Test);
+void runIRPassesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.cpp b/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.cpp
index fc21593c5415c..7eb381d3c1905 100644
--- a/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.cpp
+++ b/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.cpp
@@ -19,7 +19,7 @@ using namespace llvm;
/// Calls simplifyInstruction in each instruction in functions, and replaces
/// their values.
-static void extractInstrFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::simplifyInstructionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
std::vector<Instruction *> InstsToDelete;
Module &Program = WorkItem.getModule();
@@ -44,7 +44,3 @@ static void extractInstrFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
for (Instruction *I : InstToDelete)
I->eraseFromParent();
}
-
-void llvm::simplifyInstructionsDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, extractInstrFromModule, "Simplifying Instructions");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.h b/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.h
index 215cffcd4d12e..4e4b913e3d191 100644
--- a/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.h
+++ b/llvm/tools/llvm-reduce/deltas/SimplifyInstructions.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void simplifyInstructionsDeltaPass(TestRunner &Test);
+void simplifyInstructionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/StripDebugInfo.cpp b/llvm/tools/llvm-reduce/deltas/StripDebugInfo.cpp
index c9e1261c366a7..c8077d20fdd29 100644
--- a/llvm/tools/llvm-reduce/deltas/StripDebugInfo.cpp
+++ b/llvm/tools/llvm-reduce/deltas/StripDebugInfo.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "StripDebugInfo.h"
-#include "Delta.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Metadata.h"
@@ -15,7 +14,7 @@ using namespace llvm;
/// Removes all aliases aren't inside any of the
/// desired Chunks.
-static void stripDebugInfoImpl(Oracle &O, ReducerWorkItem &WorkItem) {
+void llvm::stripDebugInfoDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
Module &Program = WorkItem.getModule();
bool HasDebugInfo = any_of(Program.named_metadata(), [](NamedMDNode &NMD) {
return NMD.getName().starts_with("llvm.dbg.");
@@ -23,7 +22,3 @@ static void stripDebugInfoImpl(Oracle &O, ReducerWorkItem &WorkItem) {
if (HasDebugInfo && !O.shouldKeep())
StripDebugInfo(Program);
}
-
-void llvm::stripDebugInfoDeltaPass(TestRunner &Test) {
- runDeltaPass(Test, stripDebugInfoImpl, "Stripping Debug Info");
-}
diff --git a/llvm/tools/llvm-reduce/deltas/StripDebugInfo.h b/llvm/tools/llvm-reduce/deltas/StripDebugInfo.h
index 56be459546e94..b88bb98ce668c 100644
--- a/llvm/tools/llvm-reduce/deltas/StripDebugInfo.h
+++ b/llvm/tools/llvm-reduce/deltas/StripDebugInfo.h
@@ -12,7 +12,7 @@
#include "Delta.h"
namespace llvm {
-void stripDebugInfoDeltaPass(TestRunner &Test);
+void stripDebugInfoDeltaPass(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
>From 97c953ecf40ff99ba9a04796d9e782b9bf690fc2 Mon Sep 17 00:00:00 2001
From: YLChenZ <chentongyongcz at gmail.com>
Date: Sat, 29 Mar 2025 12:33:38 +0800
Subject: [PATCH 2/8] [llvm-reduce] fix compilation errors
---
llvm/tools/llvm-reduce/DeltaManager.cpp | 2 --
llvm/tools/llvm-reduce/DeltaPass.h | 4 ++++
llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index 699e5e5dd523b..61f4308a0af00 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -13,9 +13,7 @@
#include "DeltaManager.h"
#include "DeltaPass.h"
-#include "ReducerWorkItem.h"
#include "TestRunner.h"
-#include "deltas/Delta.h"
#include "deltas/ReduceAliases.h"
#include "deltas/ReduceArguments.h"
#include "deltas/ReduceAttributes.h"
diff --git a/llvm/tools/llvm-reduce/DeltaPass.h b/llvm/tools/llvm-reduce/DeltaPass.h
index b11b84087c10e..268abc07cc114 100644
--- a/llvm/tools/llvm-reduce/DeltaPass.h
+++ b/llvm/tools/llvm-reduce/DeltaPass.h
@@ -9,6 +9,10 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
+#include "llvm/ADT/StringRef.h"
+#include "ReducerWorkItem.h"
+#include "deltas/Delta.h"
+
namespace llvm {
struct DeltaPass {
StringRef Name; // e.g., "strip-debug-info"
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
index f0f6ef0837985..63d7abe61bda7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
@@ -166,6 +166,6 @@ class AttributeRemapper : public InstVisitor<AttributeRemapper> {
/// Removes out-of-chunk attributes from module.
void llvm::reduceAttributesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
- AttributeRemapper R(O, WorkItem.getContext());
+ AttributeRemapper R(O, WorkItem.getModule());
R.visit(WorkItem.getModule());
}
>From 6f20fa85ab309245706bed601a6f8a116b1e003b Mon Sep 17 00:00:00 2001
From: YLChenZ <chentongyongcz at gmail.com>
Date: Sat, 29 Mar 2025 12:39:59 +0800
Subject: [PATCH 3/8] [llvm-reduce] fixclang-format error
---
llvm/tools/llvm-reduce/DeltaPass.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-reduce/DeltaPass.h b/llvm/tools/llvm-reduce/DeltaPass.h
index 268abc07cc114..f90918ed3832a 100644
--- a/llvm/tools/llvm-reduce/DeltaPass.h
+++ b/llvm/tools/llvm-reduce/DeltaPass.h
@@ -9,9 +9,9 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
-#include "llvm/ADT/StringRef.h"
#include "ReducerWorkItem.h"
#include "deltas/Delta.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
struct DeltaPass {
>From fcc55bb3a631f80817d6a025111d2b999e1d5cc0 Mon Sep 17 00:00:00 2001
From: YLChenZ <chentongyongcz at gmail.com>
Date: Sat, 29 Mar 2025 18:19:51 +0800
Subject: [PATCH 4/8] [llvm-reduce] fix errors
---
llvm/tools/llvm-reduce/DeltaManager.cpp | 16 ++-----
llvm/tools/llvm-reduce/DeltaPass.h | 6 +--
llvm/tools/llvm-reduce/DeltaPasses.def | 48 +++++++++----------
llvm/tools/llvm-reduce/deltas/Delta.cpp | 16 +++----
llvm/tools/llvm-reduce/deltas/Delta.h | 4 +-
.../llvm-reduce/deltas/ReduceAliases.cpp | 2 +-
.../llvm-reduce/deltas/ReduceArguments.cpp | 2 +-
.../llvm-reduce/deltas/ReduceDIMetadata.cpp | 2 +-
.../llvm-reduce/deltas/ReduceDbgRecords.cpp | 2 +-
.../deltas/ReduceDistinctMetadata.cpp | 2 +-
.../llvm-reduce/deltas/ReduceFunctions.cpp | 2 +-
.../deltas/ReduceGlobalObjects.cpp | 2 +-
.../llvm-reduce/deltas/ReduceGlobalValues.cpp | 2 +-
.../deltas/ReduceGlobalVarInitializers.cpp | 2 +-
.../llvm-reduce/deltas/ReduceGlobalVars.cpp | 2 +-
.../llvm-reduce/deltas/ReduceIRReferences.cpp | 2 +-
.../deltas/ReduceInstructionFlags.cpp | 2 +-
.../deltas/ReduceInstructionFlagsMIR.cpp | 2 +-
.../deltas/ReduceInstructionsMIR.cpp | 2 +-
.../llvm-reduce/deltas/ReduceInvokes.cpp | 2 +-
.../deltas/ReduceMemoryOperations.cpp | 5 --
.../llvm-reduce/deltas/ReduceMetadata.cpp | 2 +-
.../llvm-reduce/deltas/ReduceModuleData.cpp | 2 +-
.../llvm-reduce/deltas/ReduceOpcodes.cpp | 2 +-
.../deltas/ReduceOperandBundles.cpp | 2 +-
.../llvm-reduce/deltas/ReduceOperands.cpp | 2 +-
.../llvm-reduce/deltas/ReduceOperandsSkip.cpp | 2 +-
.../deltas/ReduceOperandsToArgs.cpp | 2 +-
.../llvm-reduce/deltas/ReduceRegisterDefs.cpp | 2 +-
.../deltas/ReduceRegisterMasks.cpp | 2 +-
.../llvm-reduce/deltas/ReduceRegisterUses.cpp | 2 +-
.../deltas/ReduceSpecialGlobals.cpp | 2 +-
.../deltas/ReduceUsingSimplifyCFG.cpp | 2 +-
.../deltas/ReduceVirtualRegisters.cpp | 2 +-
llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp | 2 +-
35 files changed, 70 insertions(+), 83 deletions(-)
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index 61f4308a0af00..5281b1d5aebf2 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -87,26 +87,18 @@ static const DeltaPass MIR_Passes[] = {
#undef DELTA_PASS_MIR
};
-static SmallString<64> getPassMessage(const DeltaPass &Pass) {
- SmallString<64> Message = Pass.Desc;
- Message += " (";
- Message += Pass.Name;
- Message += ')';
- return Message;
-}
-
static void runAllDeltaPasses(TestRunner &Tester,
const SmallStringSet &SkipPass) {
if (Tester.getProgram().isMIR()) {
for (const DeltaPass &Pass : MIR_Passes) {
if (!SkipPass.count(Pass.Name)) {
- runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ runDeltaPass(Tester, Pass);
}
}
} else {
for (const DeltaPass &Pass : IR_Passes) {
if (!SkipPass.count(Pass.Name)) {
- runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ runDeltaPass(Tester, Pass);
}
}
}
@@ -116,14 +108,14 @@ static void runDeltaPassName(TestRunner &Tester, StringRef PassName) {
if (Tester.getProgram().isMIR()) {
for (const DeltaPass &Pass : MIR_Passes) {
if (PassName == Pass.Name) {
- runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ runDeltaPass(Tester, Pass);
return;
}
}
} else {
for (const DeltaPass &Pass : IR_Passes) {
if (PassName == Pass.Name) {
- runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
+ runDeltaPass(Tester, Pass);
return;
}
}
diff --git a/llvm/tools/llvm-reduce/DeltaPass.h b/llvm/tools/llvm-reduce/DeltaPass.h
index f90918ed3832a..b6dff78805435 100644
--- a/llvm/tools/llvm-reduce/DeltaPass.h
+++ b/llvm/tools/llvm-reduce/DeltaPass.h
@@ -9,16 +9,16 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
+#include "llvm/ADT/StringRef.h"
#include "ReducerWorkItem.h"
#include "deltas/Delta.h"
-#include "llvm/ADT/StringRef.h"
namespace llvm {
struct DeltaPass {
StringRef Name; // e.g., "strip-debug-info"
- void (*Func)(Oracle &, ReducerWorkItem &); // e.g.,stripDebugInfoDeltaPass
+ void (*Func)(Oracle &, ReducerWorkItem &); // e.g., stripDebugInfoDeltaPass
StringRef Desc; // e.g., "Stripping Debug Info"
};
} // namespace llvm
-#endif
\ No newline at end of file
+#endif
diff --git a/llvm/tools/llvm-reduce/DeltaPasses.def b/llvm/tools/llvm-reduce/DeltaPasses.def
index 5ef3f79604918..1b5576b48dcd0 100644
--- a/llvm/tools/llvm-reduce/DeltaPasses.def
+++ b/llvm/tools/llvm-reduce/DeltaPasses.def
@@ -16,14 +16,14 @@ DELTA_PASS_IR("function-bodies", reduceFunctionBodiesDeltaPass, "Reducing Functi
DELTA_PASS_IR("special-globals", reduceSpecialGlobalsDeltaPass, "Reducing Special Globals")
DELTA_PASS_IR("aliases", reduceAliasesDeltaPass, "Reducing Aliases")
DELTA_PASS_IR("ifuncs", reduceIFuncsDeltaPass, "Reducing Ifuncs")
-DELTA_PASS_IR("simplify-conditionals-true", reduceConditionalsTrueDeltaPass,"Reducing conditional branches to true")
+DELTA_PASS_IR("simplify-conditionals-true", reduceConditionalsTrueDeltaPass, "Reducing conditional branches to true")
DELTA_PASS_IR("simplify-conditionals-false",
- reduceConditionalsFalseDeltaPass,"Reducing conditional branches to false")
+ reduceConditionalsFalseDeltaPass, "Reducing conditional branches to false")
DELTA_PASS_IR("invokes", reduceInvokesDeltaPass, "Reducing Invokes")
DELTA_PASS_IR("unreachable-basic-blocks",
reduceUnreachableBasicBlocksDeltaPass, "Removing Unreachable Basic Blocks")
DELTA_PASS_IR("basic-blocks", reduceBasicBlocksDeltaPass, "Reducing Basic Blocks")
-DELTA_PASS_IR("simplify-cfg", reduceUsingSimplifyCFGDeltaPass,"Reducing using SimplifyCFG")
+DELTA_PASS_IR("simplify-cfg", reduceUsingSimplifyCFGDeltaPass, "Reducing using SimplifyCFG")
DELTA_PASS_IR("function-data", reduceFunctionDataDeltaPass, "Reducing Function Data")
DELTA_PASS_IR("global-values", reduceGlobalValuesDeltaPass, "Reducing GlobalValues")
DELTA_PASS_IR("global-objects", reduceGlobalObjectsDeltaPass, "Reducing GlobalObjects")
@@ -33,23 +33,23 @@ DELTA_PASS_IR("di-metadata", reduceDIMetadataDeltaPass, "Reducing DIMetadata")
DELTA_PASS_IR("dbg-records", reduceDbgRecordDeltaPass, "Reducing DbgRecords")
DELTA_PASS_IR("distinct-metadata", reduceDistinctMetadataDeltaPass, "Reducing Distinct Metadata")
DELTA_PASS_IR("metadata", reduceMetadataDeltaPass,"Reducing Metadata")
-DELTA_PASS_IR("named-metadata", reduceNamedMetadataDeltaPass,"Reducing Named Metadata")
+DELTA_PASS_IR("named-metadata", reduceNamedMetadataDeltaPass, "Reducing Named Metadata")
DELTA_PASS_IR("arguments", reduceArgumentsDeltaPass, "Reducing Arguments")
DELTA_PASS_IR("instructions", reduceInstructionsDeltaPass, "Reducing Instructions")
-DELTA_PASS_IR("simplify-instructions", simplifyInstructionsDeltaPass,"Simplifying Instructions")
-DELTA_PASS_IR("ir-passes", runIRPassesDeltaPass,"Running passes")
-DELTA_PASS_IR("operands-zero", reduceOperandsZeroDeltaPass,"Reducing Operands to zero")
-DELTA_PASS_IR("operands-one", reduceOperandsOneDeltaPass,"Reducing Operands to one")
-DELTA_PASS_IR("operands-nan", reduceOperandsNaNDeltaPass,"Reducing Operands to NaN")
-DELTA_PASS_IR("operands-to-args", reduceOperandsToArgsDeltaPass,"Converting operands to function arguments")
-DELTA_PASS_IR("operands-skip", reduceOperandsSkipDeltaPass,"Reducing operands by skipping over instructions")
-DELTA_PASS_IR("operand-bundles", reduceOperandBundesDeltaPass,"Reducing Operand Bundles")
+DELTA_PASS_IR("simplify-instructions", simplifyInstructionsDeltaPass, "Simplifying Instructions")
+DELTA_PASS_IR("ir-passes", runIRPassesDeltaPass, "Running passes")
+DELTA_PASS_IR("operands-zero", reduceOperandsZeroDeltaPass, "Reducing Operands to zero")
+DELTA_PASS_IR("operands-one", reduceOperandsOneDeltaPass, "Reducing Operands to one")
+DELTA_PASS_IR("operands-nan", reduceOperandsNaNDeltaPass, "Reducing Operands to NaN")
+DELTA_PASS_IR("operands-to-args", reduceOperandsToArgsDeltaPass, "Converting operands to function arguments")
+DELTA_PASS_IR("operands-skip", reduceOperandsSkipDeltaPass, "Reducing operands by skipping over instructions")
+DELTA_PASS_IR("operand-bundles", reduceOperandBundesDeltaPass, "Reducing Operand Bundles")
DELTA_PASS_IR("attributes", reduceAttributesDeltaPass, "Reducing Attributes")
-DELTA_PASS_IR("module-data", reduceModuleDataDeltaPass,"Reducing Module Data")
-DELTA_PASS_IR("opcodes", reduceOpcodesDeltaPass,"Reducing Opcodes")
-DELTA_PASS_IR("volatile", reduceVolatileInstructionsDeltaPass,"Reducing Volatile Instructions")
-DELTA_PASS_IR("atomic-ordering", reduceAtomicOrderingDeltaPass,"Reducing Atomic Ordering")
-DELTA_PASS_IR("syncscopes", reduceAtomicSyncScopesDeltaPass,"Reducing Atomic Sync Scopes")
+DELTA_PASS_IR("module-data", reduceModuleDataDeltaPass, "Reducing Module Data")
+DELTA_PASS_IR("opcodes", reduceOpcodesDeltaPass, "Reducing Opcodes")
+DELTA_PASS_IR("volatile", reduceVolatileInstructionsDeltaPass, "Reducing Volatile Instructions")
+DELTA_PASS_IR("atomic-ordering", reduceAtomicOrderingDeltaPass, "Reducing Atomic Ordering")
+DELTA_PASS_IR("syncscopes", reduceAtomicSyncScopesDeltaPass, "Reducing Atomic Sync Scopes")
DELTA_PASS_IR("instruction-flags", reduceInstructionFlagsDeltaPass, "Reducing Instruction Flags")
@@ -58,11 +58,11 @@ DELTA_PASS_IR("instruction-flags", reduceInstructionFlagsDeltaPass, "Reducing In
#endif
DELTA_PASS_MIR("instructions", reduceInstructionsMIRDeltaPass, "Reducing Instructions")
DELTA_PASS_MIR("ir-instruction-references",
- reduceIRInstructionReferencesDeltaPass,"Reducing IR references from instructions")
-DELTA_PASS_MIR("ir-block-references", reduceIRBlockReferencesDeltaPass,"Reducing IR references from blocks")
-DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions")
+ reduceIRInstructionReferencesDeltaPass, "Reducing IR references from instructions")
+DELTA_PASS_MIR("ir-block-references", reduceIRBlockReferencesDeltaPass, "Reducing IR references from blocks")
+DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass, "Reducing IR references from functions")
DELTA_PASS_MIR("instruction-flags", reduceInstructionFlagsMIRDeltaPass, "Reducing Instruction Flags")
-DELTA_PASS_MIR("register-uses", reduceRegisterUsesMIRDeltaPass,"Reducing register uses")
-DELTA_PASS_MIR("register-defs", reduceRegisterDefsMIRDeltaPass,"Reducing register defs")
-DELTA_PASS_MIR("register-hints", reduceVirtualRegisterHintsDeltaPass,"Reducing virtual register hints from functions")
-DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass,"Reducing register masks")
\ No newline at end of file
+DELTA_PASS_MIR("register-uses", reduceRegisterUsesMIRDeltaPass, "Reducing register uses")
+DELTA_PASS_MIR("register-defs", reduceRegisterDefsMIRDeltaPass, "Reducing register defs")
+DELTA_PASS_MIR("register-hints", reduceVirtualRegisterHintsDeltaPass, "Reducing virtual register hints from functions")
+DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass, "Reducing register masks")
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 6f84b6c09d145..87be885ab572c 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -31,6 +31,7 @@
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/WithColor.h"
#include <fstream>
+#include "DeltaPass.h"
using namespace llvm;
@@ -180,11 +181,10 @@ using SharedTaskQueue = std::deque<std::shared_future<SmallString<0>>>;
/// reduces the amount of chunks that are considered interesting by the
/// given test. The number of chunks is determined by a preliminary run of the
/// reduction pass where no change must be made to the module.
-void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
- StringRef Message) {
+void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
assert(!Test.getProgram().verify(&errs()) &&
"input module is broken before making changes");
- errs() << "*** " << Message << "...\n";
+ errs() << "*** " << Pass.Desc << " (" << Pass.Name << ')' << "...\n";
int Targets;
{
@@ -193,7 +193,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
// made.
std::vector<Chunk> AllChunks = {{0, INT_MAX}};
Oracle Counter(AllChunks);
- ExtractChunksFromModule(Counter, Test.getProgram());
+ Pass.Func(Counter, Test.getProgram());
Targets = Counter.count();
assert(!Test.getProgram().verify(&errs()) &&
@@ -215,7 +215,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
Oracle NoChunksCounter(NoChunks);
std::unique_ptr<ReducerWorkItem> Clone =
Test.getProgram().clone(Test.getTargetMachine());
- ExtractChunksFromModule(NoChunksCounter, *Clone);
+ Pass.Func(NoChunksCounter, *Clone);
assert(Targets == NoChunksCounter.count() &&
"number of chunks changes when reducing");
#endif
@@ -281,7 +281,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
Chunk ChunkToCheck = *(I + J);
TaskQueue.emplace_back(ChunkThreadPool.async(
ProcessChunkFromSerializedBitcode, ChunkToCheck, std::ref(Test),
- ExtractChunksFromModule, UninterestingChunks,
+ Pass.Func, UninterestingChunks,
ChunksStillConsideredInteresting, OriginalBC,
std::ref(AnyReduced)));
}
@@ -305,7 +305,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
Chunk ChunkToCheck = *(I + NumScheduledTasks);
TaskQueue.emplace_back(ChunkThreadPool.async(
ProcessChunkFromSerializedBitcode, ChunkToCheck,
- std::ref(Test), ExtractChunksFromModule, UninterestingChunks,
+ std::ref(Test), Pass.Func, UninterestingChunks,
ChunksStillConsideredInteresting, OriginalBC,
std::ref(AnyReduced)));
}
@@ -332,7 +332,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
} else {
Result =
CheckChunk(*I, Test.getProgram().clone(Test.getTargetMachine()),
- Test, ExtractChunksFromModule, UninterestingChunks,
+ Test, Pass.Func, UninterestingChunks,
ChunksStillConsideredInteresting);
}
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.h b/llvm/tools/llvm-reduce/deltas/Delta.h
index 0f12282e66d7d..08f6187efe6c6 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.h
+++ b/llvm/tools/llvm-reduce/deltas/Delta.h
@@ -25,6 +25,7 @@
namespace llvm {
class TestRunner;
+struct DeltaPass;
struct Chunk {
int Begin;
@@ -135,8 +136,7 @@ using ReductionFunc = function_ref<void(Oracle &, ReducerWorkItem &)>;
///
/// Other implementations of the Delta Debugging algorithm can also be found in
/// the CReduce, Delta, and Lithium projects.
-void runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
- StringRef Message);
+void runDeltaPass(TestRunner &Test, const DeltaPass &Pass);
} // namespace llvm
#endif
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp b/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
index 2dec80d7876e0..00d7ce9bd763d 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
@@ -41,4 +41,4 @@ void llvm::reduceIFuncsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
if (!IFuncs.empty())
lowerGlobalIFuncUsersAsGlobalCtor(Mod, IFuncs);
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp b/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
index 8622de9aa121e..690cfc9ef4732 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
@@ -175,4 +175,4 @@ void llvm::reduceArgumentsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
F->replaceAllUsesWith(ClonedFunc);
F->eraseFromParent();
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
index 404a09b9d07ea..8d1d73785f567 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
@@ -92,4 +92,4 @@ void llvm::reduceDIMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
MDs.push_back(DI);
}
identifyUninterestingMDNodes(O, MDs);
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
index b43a7c999b162..4de942d459b69 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
@@ -34,4 +34,4 @@ void llvm::reduceDbgRecordDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
for (DbgRecord &DR : llvm::make_early_inc_range(I.getDbgRecordRange()))
if (!O.shouldKeep())
DR.eraseFromParent();
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp
index dc8ebf61d3180..4b3c5f58fe549 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDistinctMetadata.cpp
@@ -133,4 +133,4 @@ void llvm::reduceDistinctMetadataDeltaPass(Oracle &O,
}
for (NamedMDNode &NamedNode : Program.named_metadata())
cleanUpTemporaries(NamedNode, TemporaryTuple, Program);
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
index bb0e702ef5ec3..44f1e52204f2f 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
@@ -53,4 +53,4 @@ void llvm::reduceFunctionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
// And finally, fully drop it.
cast<Function>(F)->eraseFromParent();
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
index b238fb652d594..64bf711f23d52 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
@@ -28,4 +28,4 @@ void llvm::reduceGlobalObjectsDeltaPass(Oracle &O, ReducerWorkItem &Program) {
if (shouldReduceComdat(GO) && !O.shouldKeep())
GO.setComdat(nullptr);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp
index 31c255f7539b0..577e0f5d16b63 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalValues.cpp
@@ -65,4 +65,4 @@ void llvm::reduceGlobalValuesDeltaPass(Oracle &O, ReducerWorkItem &Program) {
GV.setDSOLocal(false);
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
index 88f96dc5a6466..e285e6f7ba67f 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
@@ -29,4 +29,4 @@ void llvm::reduceGlobalsInitializersDeltaPass(Oracle &O,
GV.setLinkage(GlobalValue::LinkageTypes::ExternalLinkage);
GV.setComdat(nullptr);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp
index e20f009a254d5..ff5f643935b46 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp
@@ -54,4 +54,4 @@ void llvm::reduceGlobalsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
GV->replaceAllUsesWith(getDefaultValue(GV->getType()));
cast<GlobalVariable>(GV)->eraseFromParent();
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp b/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp
index 3703b403e7c78..231883fc1f4f3 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp
@@ -68,4 +68,4 @@ void llvm::reduceIRFunctionReferencesDeltaPass(Oracle &O,
}
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
index 1b66d602674a2..2937550bfec75 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp
@@ -82,4 +82,4 @@ void llvm::reduceInstructionFlagsDeltaPass(Oracle &O,
}
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp
index 60f8e6527047d..70dbd85a8da93 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp
@@ -30,4 +30,4 @@ void llvm::reduceInstructionFlagsMIRDeltaPass(Oracle &O,
}
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
index b4df24c5420ec..24975e9f7aaa7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
@@ -155,4 +155,4 @@ void llvm::reduceInstructionsMIRDeltaPass(Oracle &O,
if (MachineFunction *MF = WorkItem.MMI->getMachineFunction(F))
extractInstrFromFunction(O, *MF);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp
index 5cb92fb72d34f..ca0fb7156673a 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp
@@ -33,4 +33,4 @@ void llvm::reduceInvokesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
if (F.hasPersonalityFn())
reduceInvokesInFunction(O, F);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp b/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp
index c6c5474df52dc..4584694550936 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp
@@ -41,11 +41,6 @@ void llvm::reduceVolatileInstructionsDeltaPass(Oracle &O,
removeVolatileInFunction(O, F);
}
-// void llvm::reduceVolatileInstructionsDeltaPass(TestRunner &Test, StringRef
-// PassMessage) {
-// runDeltaPass(Test, removeVolatileInModule, PassMessage);
-// }
-
static void reduceAtomicSyncScopesInFunction(Oracle &O, Function &F) {
for (Instruction &I : instructions(F)) {
if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
index f22f0be3805e3..c0d0163dab5fb 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
@@ -120,4 +120,4 @@ void llvm::reduceMetadataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp b/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp
index 695bee1cb0f6f..4aeaef6d8d676 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceModuleData.cpp
@@ -24,4 +24,4 @@ void llvm::reduceModuleDataDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
// TODO: clear line by line rather than all at once
if (!Program.getModuleInlineAsm().empty() && !O.shouldKeep())
Program.setModuleInlineAsm("");
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp
index 62cf40987f2e3..ceea71f68c932 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp
@@ -259,4 +259,4 @@ void llvm::reduceOpcodesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
index 5ba02104e9235..e5d7b187c8107 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandBundles.cpp
@@ -101,4 +101,4 @@ void llvm::reduceOperandBundesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
for (const auto &I : R.CallsToRefine)
maybeRewriteCallWithDifferentBundles(I.first, I.second);
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
index ace56f97096d7..c135f0c9e5c36 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
@@ -167,4 +167,4 @@ void llvm::reduceOperandsNaNDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
return ConstantFP::getQNaN(Ty);
};
extractOperandsFromModule(O, WorkItem, ReduceValue);
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
index cd9e789ba90a3..2eff3da263d31 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
@@ -228,4 +228,4 @@ void llvm::reduceOperandsSkipDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
P.first->set(P.second);
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
index 6f1052a11b973..04bb9fa080e5c 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
@@ -209,4 +209,4 @@ void llvm::reduceOperandsToArgsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
substituteOperandWithArgument(&F, OperandsToReduce);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp
index 244ac79423583..e9d2e9a7b545f 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp
@@ -116,4 +116,4 @@ void llvm::reduceRegisterDefsMIRDeltaPass(Oracle &O,
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
removeDefsFromFunction(O, *MF);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp b/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp
index 5702d5c04f707..f0c4cb991f7c7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp
@@ -66,4 +66,4 @@ void llvm::reduceRegisterMasksMIRDeltaPass(Oracle &O,
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
reduceMasksInFunction(O, *MF);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp b/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp
index 655764d643779..6c07f13b52db3 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp
@@ -61,4 +61,4 @@ void llvm::reduceRegisterUsesMIRDeltaPass(Oracle &O,
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
removeUsesFromFunction(O, *MF);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp b/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
index 802e349633bfb..9a452d86c58a7 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
@@ -37,4 +37,4 @@ void llvm::reduceSpecialGlobalsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp b/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
index 10e750584bc66..ec37e248da8ed 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceUsingSimplifyCFG.cpp
@@ -65,4 +65,4 @@ void llvm::reduceConditionalsTrueDeltaPass(Oracle &O,
void llvm::reduceConditionalsFalseDeltaPass(Oracle &O,
ReducerWorkItem &WorkItem) {
reduceConditionals(O, WorkItem, false);
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp b/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp
index 8ebdb2bd948bf..ed8121d99130a 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp
@@ -38,4 +38,4 @@ void llvm::reduceVirtualRegisterHintsDeltaPass(Oracle &O,
if (auto *MF = WorkItem.MMI->getMachineFunction(F))
dropRegisterHintsFromFunction(O, *MF);
}
-}
\ No newline at end of file
+}
diff --git a/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp b/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp
index 1cb743c662c6c..da088fd65db29 100644
--- a/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp
+++ b/llvm/tools/llvm-reduce/deltas/RunIRPasses.cpp
@@ -47,4 +47,4 @@ void llvm::runIRPassesDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
report_fatal_error("Error constructing pass pipeline");
}
MPM.run(Program, MAM);
-}
\ No newline at end of file
+}
>From 3ee653f05f285b97fb58179118473008ffdc7bf7 Mon Sep 17 00:00:00 2001
From: YLChenZ <chentongyongcz at gmail.com>
Date: Sat, 29 Mar 2025 18:24:30 +0800
Subject: [PATCH 5/8] [llvm-reduce] fix clang-format error
---
llvm/tools/llvm-reduce/deltas/Delta.cpp | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 87be885ab572c..3f8576f1a4177 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "Delta.h"
+#include "DeltaPass.h"
#include "ReducerWorkItem.h"
#include "TestRunner.h"
#include "Utils.h"
@@ -31,7 +32,6 @@
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/WithColor.h"
#include <fstream>
-#include "DeltaPass.h"
using namespace llvm;
@@ -184,7 +184,7 @@ using SharedTaskQueue = std::deque<std::shared_future<SmallString<0>>>;
void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
assert(!Test.getProgram().verify(&errs()) &&
"input module is broken before making changes");
- errs() << "*** " << Pass.Desc << " (" << Pass.Name << ')' << "...\n";
+ errs() << "*** " << Pass.Desc << " (" << Pass.Name << ')' << "...\n";
int Targets;
{
@@ -281,9 +281,8 @@ void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
Chunk ChunkToCheck = *(I + J);
TaskQueue.emplace_back(ChunkThreadPool.async(
ProcessChunkFromSerializedBitcode, ChunkToCheck, std::ref(Test),
- Pass.Func, UninterestingChunks,
- ChunksStillConsideredInteresting, OriginalBC,
- std::ref(AnyReduced)));
+ Pass.Func, UninterestingChunks, ChunksStillConsideredInteresting,
+ OriginalBC, std::ref(AnyReduced)));
}
// Start processing results of the queued tasks. We wait for the first
@@ -330,10 +329,9 @@ void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
// Forward I to the last chunk processed in parallel.
I += NumChunksProcessed - 1;
} else {
- Result =
- CheckChunk(*I, Test.getProgram().clone(Test.getTargetMachine()),
- Test, Pass.Func, UninterestingChunks,
- ChunksStillConsideredInteresting);
+ Result = CheckChunk(
+ *I, Test.getProgram().clone(Test.getTargetMachine()), Test,
+ Pass.Func, UninterestingChunks, ChunksStillConsideredInteresting);
}
if (!Result)
>From cefca9fe6ed46f317344ed308d810d56dca560d5 Mon Sep 17 00:00:00 2001
From: YLChenZ <chentongyongcz at gmail.com>
Date: Sat, 29 Mar 2025 18:32:32 +0800
Subject: [PATCH 6/8] [llvm-reduce] fix clang-format error
---
llvm/tools/llvm-reduce/DeltaPass.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-reduce/DeltaPass.h b/llvm/tools/llvm-reduce/DeltaPass.h
index b6dff78805435..3231570bd23f4 100644
--- a/llvm/tools/llvm-reduce/DeltaPass.h
+++ b/llvm/tools/llvm-reduce/DeltaPass.h
@@ -9,9 +9,9 @@
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
-#include "llvm/ADT/StringRef.h"
#include "ReducerWorkItem.h"
#include "deltas/Delta.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
struct DeltaPass {
>From df50c767b0f445f017eac39aca68fe840ab830b9 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <arsenm2 at gmail.com>
Date: Sun, 30 Mar 2025 10:53:42 +0700
Subject: [PATCH 7/8] Update llvm/tools/llvm-reduce/deltas/Delta.h
---
llvm/tools/llvm-reduce/deltas/Delta.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.h b/llvm/tools/llvm-reduce/deltas/Delta.h
index 08f6187efe6c6..ec2311f067299 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.h
+++ b/llvm/tools/llvm-reduce/deltas/Delta.h
@@ -17,7 +17,6 @@
#include "ReducerWorkItem.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <functional>
#include <utility>
>From 45bfb34339d4e0ecf7f7b19bc66fd1cf60807b2a Mon Sep 17 00:00:00 2001
From: Matt Arsenault <arsenm2 at gmail.com>
Date: Sun, 30 Mar 2025 10:53:53 +0700
Subject: [PATCH 8/8] Update llvm/tools/llvm-reduce/deltas/Delta.cpp
---
llvm/tools/llvm-reduce/deltas/Delta.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 3f8576f1a4177..5b9f0330f9c7e 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -184,7 +184,7 @@ using SharedTaskQueue = std::deque<std::shared_future<SmallString<0>>>;
void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
assert(!Test.getProgram().verify(&errs()) &&
"input module is broken before making changes");
- errs() << "*** " << Pass.Desc << " (" << Pass.Name << ')' << "...\n";
+ errs() << "*** " << Pass.Desc << " (" << Pass.Name << ")...\n";
int Targets;
{
More information about the llvm-commits
mailing list