Skip to content

[llvm][CodeGen] Fix failure in window scheduler caused by phi #95900

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 2 commits into from
Jun 19, 2024

Conversation

huaatian
Copy link
Contributor

@huaatian huaatian commented Jun 18, 2024

In certain cases, the register passed with the kernel MBB in phi are not defined
within the kernel MBB. This patch adds the corresponding handling.

In certain cases, the register passed with the kernel MBB in phi
are not defined within the kernel MBB. The window algorithm
currently does not support such scenarios, so a check is performed
during initialization.
@huaatian
Copy link
Contributor Author

huaatian commented Jun 18, 2024

The cause of the issue is that in the phi instruction, the register passed along with the kernel MBB is not defined within the kernel MBB. We have added some handling codes.
image

@huaatian
Copy link
Contributor Author

Could you please review this code? Thank you~ @nathanchance @arsenm @dtcxzyw

if (Register AntiReg = getAntiRegister(&MI))
// Register with Kernel in phi is not defined within the Kernel itself.
if (MRI->getVRegDef(AntiReg)->getParent() != MBB) {
LLVM_DEBUG(dbgs() << "Special phi structure is not supported!\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really special. Why is this difficult to handle? It should behave like any other live in value

Copy link
Contributor Author

@huaatian huaatian Jun 18, 2024

Choose a reason for hiding this comment

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

Yes, you are right. We only need to add some checks.
Updated.

@huaatian huaatian merged commit dd1d2b7 into llvm:main Jun 19, 2024
7 checks passed
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
…5900)

In certain cases, the register passed with the kernel MBB in phi are not
defined within the kernel MBB. This patch adds the corresponding handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:codegen mi-sched machine instruction scheduler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants