We randomly use outs() or errs(), which makes test logs confusing.
We also randomly add/don't add a line afterward.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D136130
/// 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) {
+void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
+ StringRef Message) {
assert(!verifyReducerWorkItem(Test.getProgram(), &errs()) &&
"input module is broken before making changes");
+ errs() << "*** " << Message << "...\n";
SmallString<128> CurrentFilepath;
if (!isReduced(Test.getProgram(), Test, CurrentFilepath)) {
if (!Targets) {
if (Verbose)
errs() << "\nNothing to reduce\n";
+ errs() << "----------------------------\n";
return;
}
Test.setProgram(std::move(ReducedProgram));
if (Verbose)
errs() << "Couldn't increase anymore.\n";
+ errs() << "----------------------------\n";
}
///
/// Other implementations of the Delta Debugging algorithm can also be found in
/// the CReduce, Delta, and Lithium projects.
-void runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule);
+void runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
+ StringRef Message);
} // namespace llvm
#endif
}
void llvm::reduceAliasesDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Aliases ...\n";
- runDeltaPass(Test, extractAliasesFromModule);
- errs() << "----------------------------\n";
+ runDeltaPass(Test, extractAliasesFromModule, "Reducing Aliases");
}
}
void llvm::reduceArgumentsDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Arguments...\n";
- runDeltaPass(Test, extractArgumentsFromModule);
+ runDeltaPass(Test, extractArgumentsFromModule, "Reducing Arguments");
}
}
void llvm::reduceAttributesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Attributes...\n";
- runDeltaPass(Test, extractAttributesFromModule);
+ runDeltaPass(Test, extractAttributesFromModule, "Reducing Attributes");
}
}
void llvm::reduceBasicBlocksDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Basic Blocks...\n";
- runDeltaPass(Test, extractBasicBlocksFromModule);
+ runDeltaPass(Test, extractBasicBlocksFromModule, "Reducing Basic Blocks");
}
}
void llvm::reduceDIMetadataDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing DIMetadata...\n";
- runDeltaPass(Test, extractDIMetadataFromModule);
- outs() << "----------------------------\n";
+ runDeltaPass(Test, extractDIMetadataFromModule, "Reducing DIMetadata");
}
}
void llvm::reduceFunctionBodiesDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Function Bodies...\n";
- runDeltaPass(Test, extractFunctionBodiesFromModule);
- errs() << "----------------------------\n";
+ runDeltaPass(Test, extractFunctionBodiesFromModule,
+ "Reducing Function Bodies");
}
}
void llvm::reduceFunctionsDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Functions...\n";
- runDeltaPass(Test, extractFunctionsFromModule);
- errs() << "----------------------------\n";
+ runDeltaPass(Test, extractFunctionsFromModule, "Reducing Functions");
}
}
void llvm::reduceGlobalObjectsDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing GlobalObjects...\n";
- runDeltaPass(Test, reduceGOs);
+ runDeltaPass(Test, reduceGOs, "Reducing GlobalObjects");
}
}
void llvm::reduceGlobalValuesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing GlobalValues...\n";
- runDeltaPass(Test, reduceGVs);
+ runDeltaPass(Test, reduceGVs, "Reducing GlobalValues");
}
}
void llvm::reduceGlobalsInitializersDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing GVs initializers...\n";
- runDeltaPass(Test, extractGVsFromModule);
+ runDeltaPass(Test, extractGVsFromModule, "Reducing GV Initializers");
}
}
void llvm::reduceGlobalsDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing GVs...\n";
- runDeltaPass(Test, extractGVsFromModule);
+ runDeltaPass(Test, extractGVsFromModule, "Reducing GlobalVariables");
}
}
void llvm::reduceIRInstructionReferencesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing IR references from instructions...\n";
- runDeltaPass(Test, stripIRFromInstructions);
+ runDeltaPass(Test, stripIRFromInstructions,
+ "Reducing IR references from instructions");
}
void llvm::reduceIRBlockReferencesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing IR references from blocks...\n";
- runDeltaPass(Test, stripIRFromBlocks);
+ runDeltaPass(Test, stripIRFromBlocks, "Reducing IR references from blocks");
}
void llvm::reduceIRFunctionReferencesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing IR references from functions...\n";
- runDeltaPass(Test, stripIRFromFunctions);
+ runDeltaPass(Test, stripIRFromFunctions,
+ "Reducing IR references from functions");
}
}
void llvm::reduceInstructionFlagsMIRDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Instruction flags...\n";
- runDeltaPass(Test, removeFlagsFromModule);
+ runDeltaPass(Test, removeFlagsFromModule, "Reducing Instruction Flags");
}
}
void llvm::reduceInstructionsDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Instructions...\n";
- runDeltaPass(Test, extractInstrFromModule);
+ runDeltaPass(Test, extractInstrFromModule, "Reducing Instructions");
}
}
void llvm::reduceInstructionsMIRDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Instructions...\n";
- runDeltaPass(Test, extractInstrFromModule);
+ runDeltaPass(Test, extractInstrFromModule, "Reducing Instructions");
}
}
void llvm::reduceMetadataDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Metadata...\n";
- runDeltaPass(Test, extractMetadataFromModule);
- outs() << "----------------------------\n";
+ runDeltaPass(Test, extractMetadataFromModule, "Reducing Metadata");
}
}
void llvm::reduceModuleDataDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Module Data...\n";
- runDeltaPass(Test, clearModuleData);
+ runDeltaPass(Test, clearModuleData, "Reducing Module Data");
}
}
void llvm::reduceOpcodesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Opcodes...\n";
- runDeltaPass(Test, replaceOpcodesInModule);
+ runDeltaPass(Test, replaceOpcodesInModule, "Reducing Opcodes");
}
}
void llvm::reduceOperandBundesDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing OperandBundes...\n";
- runDeltaPass(Test, extractOperandBundesFromModule);
+ runDeltaPass(Test, extractOperandBundesFromModule,
+ "Reducing Operand Bundles");
}
}
void llvm::reduceOperandsOneDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Operands to one...\n";
auto ReduceValue = [](Use &Op) -> Value * {
if (!shouldReduceOperand(Op))
return nullptr;
return nullptr;
};
- runDeltaPass(Test, [ReduceValue](Oracle &O, Module &Program) {
- extractOperandsFromModule(O, Program, ReduceValue);
- });
+ runDeltaPass(
+ Test,
+ [ReduceValue](Oracle &O, Module &Program) {
+ extractOperandsFromModule(O, Program, ReduceValue);
+ },
+ "Reducing Operands to one");
}
void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Operands to zero...\n";
auto ReduceValue = [](Use &Op) -> Value * {
if (!shouldReduceOperand(Op))
return nullptr;
// Don't replace existing zeroes.
return isZero(Op) ? nullptr : Constant::getNullValue(Op->getType());
};
- runDeltaPass(Test, [ReduceValue](Oracle &O, Module &Program) {
- extractOperandsFromModule(O, Program, ReduceValue);
- });
+ runDeltaPass(
+ Test,
+ [ReduceValue](Oracle &O, Module &Program) {
+ extractOperandsFromModule(O, Program, ReduceValue);
+ },
+ "Reducing Operands to zero");
}
void llvm::reduceOperandsNaNDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Operands to NaN...\n";
auto ReduceValue = [](Use &Op) -> Value * {
Type *Ty = Op->getType();
if (!Ty->isFPOrFPVectorTy())
return ConstantFP::getQNaN(Ty);
};
- runDeltaPass(Test, [ReduceValue](Oracle &O, Module &Program) {
- extractOperandsFromModule(O, Program, ReduceValue);
- });
+ runDeltaPass(
+ Test,
+ [ReduceValue](Oracle &O, Module &Program) {
+ extractOperandsFromModule(O, Program, ReduceValue);
+ },
+ "Reducing Operands to NaN");
}
}
void llvm::reduceOperandsSkipDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing operands by skipping over instructions ...\n";
- runDeltaPass(Test, extractOperandsFromModule);
+ runDeltaPass(Test, extractOperandsFromModule,
+ "Reducing operands by skipping over instructions");
}
}
void llvm::reduceOperandsToArgsDeltaPass(TestRunner &Test) {
- outs() << "*** Converting operands to function arguments ...\n";
- return runDeltaPass(Test, reduceOperandsToArgs);
+ runDeltaPass(Test, reduceOperandsToArgs,
+ "Converting operands to function arguments");
}
}
void llvm::reduceRegisterDefsMIRDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing register defs...\n";
- runDeltaPass(Test, removeDefsFromModule);
+ runDeltaPass(Test, removeDefsFromModule, "Reducing register defs");
}
}
void llvm::reduceRegisterMasksMIRDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing register masks...\n";
- runDeltaPass(Test, reduceMasksInModule);
+ runDeltaPass(Test, reduceMasksInModule, "Reducing register masks");
}
}
void llvm::reduceRegisterUsesMIRDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing register uses...\n";
- runDeltaPass(Test, removeUsesFromModule);
+ runDeltaPass(Test, removeUsesFromModule, "Reducing register uses");
}
}
void llvm::reduceSpecialGlobalsDeltaPass(TestRunner &Test) {
- errs() << "*** Reducing Special Globals ...\n";
- runDeltaPass(Test, extractSpecialGlobalsFromModule);
- errs() << "----------------------------\n";
+ runDeltaPass(Test, extractSpecialGlobalsFromModule,
+ "Reducing Special Globals");
}
}
void llvm::reduceUsingSimplifyCFGDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing using SimplifyCFG...\n";
- runDeltaPass(Test, reduceUsingSimplifyCFG);
+ runDeltaPass(Test, reduceUsingSimplifyCFG, "Reducing using SimplifyCFG");
}
}
void llvm::reduceVirtualRegisterHintsDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing virtual register hints from functions...\n";
- runDeltaPass(Test, dropRegisterHintsFromFunctions);
+ runDeltaPass(Test, dropRegisterHintsFromFunctions,
+ "Reducing virtual register hints from functions");
}
}
void llvm::runIRPassesDeltaPass(TestRunner &Test) {
- errs() << "*** Running passes ...\n";
- runDeltaPass(Test, runPasses);
- errs() << "----------------------------\n";
+ runDeltaPass(Test, runPasses, "Running passes");
}
}
void llvm::simplifyInstructionsDeltaPass(TestRunner &Test) {
- outs() << "*** Simplifying Instructions...\n";
- runDeltaPass(Test, extractInstrFromModule);
+ runDeltaPass(Test, extractInstrFromModule, "Simplifying Instructions");
}
if (OutputFilename == "-")
Tester.getProgram().print(outs(), nullptr);
else
- writeOutput(Tester.getProgram(), "\nDone reducing! Reduced testcase: ");
+ writeOutput(Tester.getProgram(), "Done reducing! Reduced testcase: ");
return 0;
}