Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm-reduce]: print short form, actionable names in the log #132813

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions clang/lib/Frontend/ASTUnit.cpp
Original file line number Diff line number Diff line change
@@ -832,11 +832,10 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
AST->ModCache = createCrossProcessModuleCache();
AST->HSOpts = HSOpts ? HSOpts : std::make_shared<HeaderSearchOptions>();
AST->HSOpts->ModuleFormat = std::string(PCHContainerRdr.getFormats().front());
AST->HeaderInfo.reset(new HeaderSearch(AST->getHeaderSearchOpts(),
AST->getSourceManager(),
AST->getDiagnostics(),
AST->getLangOpts(),
/*Target=*/nullptr));
AST->HeaderInfo.reset(
new HeaderSearch(AST->getHeaderSearchOpts(), AST->getSourceManager(),
AST->getDiagnostics(), AST->getLangOpts(),
/*Target=*/nullptr));
Comment on lines +835 to +838
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to have pulled in a lot of unrelated changes

AST->PPOpts = std::make_shared<PreprocessorOptions>();

// Gather Info for preprocessor construction later on.
3 changes: 1 addition & 2 deletions clang/lib/Lex/ModuleMap.cpp
Original file line number Diff line number Diff line change
@@ -353,8 +353,7 @@ ModuleMap::ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags,
const LangOptions &LangOpts, const TargetInfo *Target,
HeaderSearch &HeaderInfo)
: SourceMgr(SourceMgr), Diags(Diags), LangOpts(LangOpts), Target(Target),
HeaderInfo(HeaderInfo) {
}
HeaderInfo(HeaderInfo) {}

ModuleMap::~ModuleMap() = default;

6 changes: 4 additions & 2 deletions clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
@@ -9613,9 +9613,11 @@ ModuleFile *ASTReader::getLocalModuleFile(ModuleFile &M, unsigned ID) const {
return I == GlobalSubmoduleMap.end() ? nullptr : I->second;
} else {
// It's a prefix (preamble, PCH, ...). Look it up by index.
int IndexFromEnd = static_cast<int>(ID >> 1);
int IndexFromEnd = static_cast<int>(ID >> 1);
assert(IndexFromEnd && "got reference to unknown module file");
return getModuleManager().pch_modules().end()[-static_cast<int>(IndexFromEnd)];
return getModuleManager()
.pch_modules()
.end()[-static_cast<int>(IndexFromEnd)];
}
}

2 changes: 1 addition & 1 deletion flang/lib/Evaluate/fold-logical.cpp
Original file line number Diff line number Diff line change
@@ -880,7 +880,7 @@ Expr<Type<TypeCategory::Logical, KIND>> FoldIntrinsicFunction(
if (args[0]) {
if (const auto *cst{UnwrapExpr<Constant<SomeDerived>>(args[0])}) {
if (auto constr{cst->GetScalarValue()}) {
if (StructureConstructorValues & values{constr->values()};
if (StructureConstructorValues &values{constr->values()};
values.size() == 1) {
const Expr<SomeType> &value{values.begin()->second.value()};
if (auto flag{ToInt64(value)}) {
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ void test() {
(void)std::forward_like<vfp>(i); // expected-error {{no matching function for call to 'forward_like'}}
(void)std::forward_like<cvfp>(i); // expected-error {{no matching function for call to 'forward_like'}}

using fpr = void()&;
using fprr = void()&&;
using fpr = void() &;
using fprr = void() &&;
Comment on lines -42 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please undo this change since it is not related to the patch.

I notice unneeded whitepaces at other places too, please undo these too.

(void)std::forward_like<fpr>(i); // expected-error {{no matching function for call to 'forward_like'}}
(void)std::forward_like<fprr>(i); // expected-error {{no matching function for call to 'forward_like'}}
}
155 changes: 72 additions & 83 deletions llvm/tools/llvm-reduce/DeltaManager.cpp
Original file line number Diff line number Diff line change
@@ -53,6 +53,8 @@
#include "deltas/StripDebugInfo.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/CommandLine.h"
#include "DeltaPass.h"
#include "llvm/ADT/ArrayRef.h"

using namespace llvm;

@@ -71,91 +73,77 @@ 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 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)) {
SmallString<64> Message;
Message += Pass.Desc;
Message += " (";
Message += Pass.Name;
Message += ")";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Message += ")";
Message += ')';

Pass.Func(Tester,Message);
}
}
} else {
DELTA_PASSES;
for(const DeltaPass &Pass : IR_Passes) {
if (!SkipPass.count(Pass.Name)) {
SmallString<64> Message;
Message += Pass.Desc;
Message += " (";
Message += Pass.Name;
Message += ")";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Message += ")";
Message += ')';

Pass.Func(Tester,Message);
}
}
}
#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) {
SmallString<64> Message;
Message += Pass.Desc;
Comment on lines +125 to +126
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SmallString<64> Message;
Message += Pass.Desc;
SmallString<64> Message = Pass.Desc;

Message += " (";
Message += Pass.Name;
Message += ")";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Message += ")";
Message += ')';

Pass.Func(Tester,Message);
return;
}
}
} else {
DELTA_PASSES;
for(const DeltaPass &Pass : IR_Passes) {
if (PassName == Pass.Name) {
SmallString<64> Message;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These cases are all building the same message formatting. I think the formatting should only be done in one place where the print finally occurs, without an intermediate string

Message += Pass.Desc;
Message += " (";
Message += Pass.Name;
Message += ")";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Message += ")";
Message += ')';

Pass.Func(Tester,Message);
return;
}
}
}
#undef DELTA_PASS

// We should have errored on unrecognized passes before trying to run
// anything.
@@ -164,24 +152,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";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OS << " " << Pass.Name << "\n";
OS << " " << Pass.Name << '\n';

}
OS << " MIR:\n";
DELTA_PASSES_MIR;
#undef DELTA_PASS
for (const DeltaPass &Pass : MIR_Passes) {
OS << " " << Pass.Name << "\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OS << " " << Pass.Name << "\n";
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
25 changes: 25 additions & 0 deletions llvm/tools/llvm-reduce/DeltaPass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//===--- 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
//
//===----------------------------------------------------------------------===//



Comment on lines +9 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAPASS_H

#include "TestRunner.h"

namespace llvm {
struct DeltaPass {
StringRef Name; // e.g., "strip-debug-info"
void (*Func)(TestRunner &, StringRef); // function pointer, e.g.,stripDebugInfoDeltaPass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use function_ref here?

StringRef Desc; // e.g., "Stripping Debug Info"
};
} // namespace llvm


#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif
#endif

68 changes: 68 additions & 0 deletions llvm/tools/llvm-reduce/DeltaPasses.def
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass,"Reducing register masks")
DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass,"Reducing register masks")

1 change: 1 addition & 0 deletions llvm/tools/llvm-reduce/deltas/Delta.h
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#include "llvm/Support/raw_ostream.h"
#include <functional>
#include <utility>
#include "llvm/ADT/StringRef.h"

namespace llvm {

8 changes: 4 additions & 4 deletions llvm/tools/llvm-reduce/deltas/ReduceAliases.cpp
Original file line number Diff line number Diff line change
@@ -44,10 +44,10 @@ static void extractIFuncsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
lowerGlobalIFuncUsersAsGlobalCtor(Mod, IFuncs);
}

void llvm::reduceAliasesDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractAliasesFromModule, "Reducing Aliases");
void llvm::reduceAliasesDeltaPass(TestRunner &Test, StringRef PassMessage) {
runDeltaPass(Test, extractAliasesFromModule, PassMessage);
}

void llvm::reduceIFuncsDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractIFuncsFromModule, "Reducing Ifuncs");
void llvm::reduceIFuncsDeltaPass(TestRunner &Test, StringRef PassMessage) {
runDeltaPass(Test, extractIFuncsFromModule, PassMessage);
}
4 changes: 2 additions & 2 deletions llvm/tools/llvm-reduce/deltas/ReduceAliases.h
Original file line number Diff line number Diff line change
@@ -17,8 +17,8 @@
#include "Delta.h"

namespace llvm {
void reduceAliasesDeltaPass(TestRunner &Test);
void reduceIFuncsDeltaPass(TestRunner &Test);
void reduceAliasesDeltaPass(TestRunner &Test, StringRef PassMessage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is backwards here. The delta pass implementations shouldn't need to be told what the message is. Instead, can we have these reduce*DeltaPasses return the function_ref to the implementation function, and have the driver in DeltaManager handle the printing of the message from the DeltaPass information?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, the DeltaPass struct would contain function_ref<void(Oracle &, ReducerWorkitem &)> as the implementation function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning the function_ref is an unnecessary indirection. The entry point signatures should just change to void(Oracle &, ReducerWorkitem&). The table can directly refer to those

void reduceIFuncsDeltaPass(TestRunner &Test, StringRef PassMessage);
} // namespace llvm

#endif
4 changes: 2 additions & 2 deletions llvm/tools/llvm-reduce/deltas/ReduceArguments.cpp
Original file line number Diff line number Diff line change
@@ -119,6 +119,6 @@ static void extractArgumentsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
}
}

void llvm::reduceArgumentsDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractArgumentsFromModule, "Reducing Arguments");
void llvm::reduceArgumentsDeltaPass(TestRunner &Test, StringRef PassMessage) {
runDeltaPass(Test, extractArgumentsFromModule, PassMessage);
}
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.