[clang] [flang] [libcxx] [llvm] [llvm-reduce]: print short form, actionable names in the log (PR #132813)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 28 08:53:52 PDT 2025
YLChenZ wrote:
@arsenm Based on your tips, I have the following in mind:
First, the function pointer field of structure DeltaPass needs to be modified to void (Oracle &, ReducerWorkItem &).
Second, instead of using reduceXXXDeltaPass to call runDeltaPass indirectly, the function pointer provided by DeltaPass is called directly in DeltaManager.
For example:
before:
```c++
//===- ReduceAliases.h - Specialized Delta Pass -----------------*- C++ -*-===//
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEALIASES_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEALIASES_H
#include "Delta.h"
namespace llvm {
void reduceAliasesDeltaPass(TestRunner &Test);
void reduceIFuncsDeltaPass(TestRunner &Test);
} // namespace llvm
#endif
```
```c++
//===- ReduceAliases.cpp - Specialized Delta Pass -------------------------===//
#include "ReduceAliases.h"
...
using namespace llvm;
/// Removes all aliases aren't inside any of the
/// desired Chunks.
static void extractAliasesFromModule(Oracle &O, ReducerWorkItem &Program) {
...
}
static void extractIFuncsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
...
}
void llvm::reduceAliasesDeltaPass(TestRunner &Test, StringRef PassMessage) {
runDeltaPass(Test, extractAliasesFromModule, PassMessage);
}
void llvm::reduceIFuncsDeltaPass(TestRunner &Test, StringRef PassMessage) {
runDeltaPass(Test, extractIFuncsFromModule, PassMessage);
}
```
after:
```c++
//===- ReduceAliases.h - Specialized Delta Pass -----------------*- C++ -*-===//
#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEALIASES_H
#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEALIASES_H
#include "Delta.h"
namespace llvm {
void extractAliasesFromModule(Oracle &O, ReducerWorkItem &Program);
void extractIFuncsFromModule(Oracle &O, ReducerWorkItem &WorkItem);
} // namespace llvm
#endif
```
```c++
//===- ReduceAliases.cpp - Specialized Delta Pass -------------------------===//
#include "ReduceAliases.h"
...
using namespace llvm;
/// Removes all aliases aren't inside any of the
/// desired Chunks.
void llvm::extractAliasesFromModule(Oracle &O, ReducerWorkItem &Program) {
...
}
void llvm::extractIFuncsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
...
}
```
Call runDeltaPass directly in DeltaManager:
```c++
...
static void runAllDeltaPasses(TestRunner &Tester,
const SmallStringSet &SkipPass) {
if (Tester.getProgram().isMIR()) {
for(const DeltaPass &Pass : MIR_Passes) {
if (!SkipPass.count(Pass.Name)) {
SmallString<64> Message = Pass.Desc;
Message += " (";
Message += Pass.Name;
Message += ')';
runDeltaPass(Tester,Pass.Func,Message);
}
}
}
...
```
https://github.com/llvm/llvm-project/pull/132813
More information about the llvm-commits
mailing list