-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[CodeGen][NPM] Update BranchFolderLegacy make tail merge configurable via flag #135277
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
1439764
1129f40
7d8d9df
9b95974
17fcc45
73b228a
f2dd02c
fc156b5
b49d6d3
1293477
756e1a5
501a1cf
61251d3
ec4571a
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 | ||
|---|---|---|---|---|
|
|
@@ -90,10 +90,13 @@ namespace { | |||
|
|
||||
| /// BranchFolderPass - Wrap branch folder in a machine function pass. | ||||
| class BranchFolderLegacy : public MachineFunctionPass { | ||||
| bool EnableTailMerge; | ||||
|
|
||||
| public: | ||||
| static char ID; | ||||
|
|
||||
| explicit BranchFolderLegacy() : MachineFunctionPass(ID) {} | ||||
| explicit BranchFolderLegacy(bool EnableTailMerge = true) | ||||
| : MachineFunctionPass(ID), EnableTailMerge(EnableTailMerge) {} | ||||
|
|
||||
| bool runOnMachineFunction(MachineFunction &MF) override; | ||||
|
|
||||
|
|
@@ -144,6 +147,13 @@ PreservedAnalyses BranchFolderPass::run(MachineFunction &MF, | |||
| return getMachineFunctionPassPreservedAnalyses(); | ||||
| } | ||||
|
|
||||
| void BranchFolderPass::printPipeline( | ||||
| raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) { | ||||
| OS << MapClassName2PassName(name()); | ||||
| if (EnableTailMerge) | ||||
| OS << "<enable-tail-merge>"; | ||||
| } | ||||
|
|
||||
| bool BranchFolderLegacy::runOnMachineFunction(MachineFunction &MF) { | ||||
| if (skipFunction(MF.getFunction())) | ||||
| return false; | ||||
|
|
@@ -152,7 +162,8 @@ bool BranchFolderLegacy::runOnMachineFunction(MachineFunction &MF) { | |||
| // TailMerge can create jump into if branches that make CFG irreducible for | ||||
| // HW that requires structurized CFG. | ||||
| bool EnableTailMerge = !MF.getTarget().requiresStructuredCFG() && | ||||
| PassConfig->getEnableTailMerge(); | ||||
| PassConfig->getEnableTailMerge() && | ||||
|
||||
| disablePass(&BranchFolderPassID); |
So by calling createBranchFolderPass, we don't check the disabled passed
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.
This also seems to bypass the -disable-branch-fold.
Any suggestions on how to proceed?
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.
I think the function properties error is from somewhere else. Most passes probably are not appropriately reporting cleared properties
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.
What test hit the property error? I think SPIRV needs to cear NoPHIs property after its selection. It's bypassing the usual place it's cleared (though I'm not sure why it's cleared here)
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.
All tests are passing with the latest version of this PR
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.
Is this avoided after the new version of #136327?
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.
This piece of code is no longer part of the PR.
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.
Are you talking about the default argument? I see that
BranchFolderPassalready takes abool EnableTailMerge:llvm-project/llvm/include/llvm/CodeGen/BranchFoldingPass.h
Line 19 in b39ab7a