Skip to content

[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

Merged
merged 8 commits into from
Mar 30, 2025

Conversation

YLChenZ
Copy link
Contributor

@YLChenZ YLChenZ commented Mar 29, 2025

Closes #132696

before the patch like this:

----------------------------
*** Reducing GlobalObjects...
----------------------------
*** Reducing GV Initializers...
----------------------------
*** Reducing GlobalVariables...
----------------------------

after the patch like this:

----------------------------
*** Reducing GlobalObjects (global-objects)...
----------------------------
*** Reducing GV Initializers (global-initializers)...
----------------------------
*** Reducing GlobalVariables (global-variables)...
----------------------------

Copy link

github-actions bot commented Mar 29, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

void llvm::reduceIFuncsDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractIFuncsFromModule, "Reducing Ifuncs");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline at end of file errors

Suggested change
}
}

void llvm::reduceArgumentsDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractArgumentsFromModule, "Reducing Arguments");
}
}
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
}
}

More of these

void llvm::reduceDIMetadataDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractDIMetadataFromModule, "Reducing DIMetadata");
}
}
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
}
}

void llvm::reduceDbgRecordDeltaPass(TestRunner &Test) {
runDeltaPass(Test, extractDbgRecordsFromModule, "Reducing DbgRecords");
}
}
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
}
}

runDeltaPass(Test, extractDistinctMetadataFromModule,
"Reducing Distinct Metadata");
}
}
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-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")

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")
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("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-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")
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("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions")
DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass, "Reducing IR references from functions")
Suggested change
DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions")
DELTA_PASS_MIR("ir-function-references", reduceIRFunctionReferencesDeltaPass,"Reducing IR references from functions")

Comment on lines 65 to 68
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-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")

DELTA_PASSES_MIR;
for (const DeltaPass &Pass : MIR_Passes) {
if (PassName == Pass.Name) {
runDeltaPass(Tester, Pass.Func, getPassMessage(Pass));
Copy link
Contributor

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

@YLChenZ
Copy link
Contributor Author

YLChenZ commented Mar 29, 2025

@arsenm Done.

Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

@YLChenZ
Copy link
Contributor Author

YLChenZ commented Mar 30, 2025

@arsenm I've learned a lot. Thanks.

@arsenm arsenm merged commit fea6b38 into llvm:main Mar 30, 2025
11 checks passed
SchrodingerZhu pushed a commit to SchrodingerZhu/llvm-project that referenced this pull request Mar 31, 2025
…3561)

Closes llvm#132696

before the patch like this:
```
----------------------------
*** Reducing GlobalObjects...
----------------------------
*** Reducing GV Initializers...
----------------------------
*** Reducing GlobalVariables...
----------------------------
```
after the patch like this:
```
----------------------------
*** Reducing GlobalObjects (global-objects)...
----------------------------
*** Reducing GV Initializers (global-initializers)...
----------------------------
*** Reducing GlobalVariables (global-variables)...
----------------------------
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

llvm-reduce should print short form, actionable names in the log
2 participants