-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[llvm-reduce]: print short form, actionable names in the log #133561
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
Changes from 3 commits
1284254
97c953e
6f20fa8
fcc55bb
3ee653f
cefca9f
df50c76
45bfb34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||
| //===--- 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 | ||||||||
|
|
||||||||
| #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 | ||||||||
| StringRef Desc; // e.g., "Stripping Debug Info" | ||||||||
| }; | ||||||||
| } // namespace llvm | ||||||||
|
|
||||||||
| #endif | ||||||||
|
||||||||
| #endif | |
| #endif | |
| 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-block-references", reduceIRBlockReferencesDeltaPass,"Reducing IR references from blocks") | |
| DELTA_PASS_MIR("ir-block-references", reduceIRBlockReferencesDeltaPass, "Reducing IR references from blocks") |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions") | |
| DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass, "Reducing IR references from functions") |
| DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions") | |
| DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions") |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass,"Reducing register masks") | |
| DELTA_PASS_MIR("register-masks", reduceRegisterMasksMIRDeltaPass,"Reducing register masks") | |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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") | |
| 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") |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -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"); | ||||||||
| } | ||||||||
| } | ||||||||
|
||||||||
| } | |
| } | |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -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"); | ||||||||
| } | ||||||||
| } | ||||||||
|
||||||||
| } | |
| } | |
More of these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify this by making runDeltaPass take const DeltaPass &. You don't need to build the intermediate string, the final print can directly consume the DeltaPass fields