Skip to content

[PowerPC] Remove DAG matching in ADDIStocHA #93905

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 4, 2024
Merged

Conversation

bzEq
Copy link
Collaborator

@bzEq bzEq commented May 31, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 31, 2024

@llvm/pr-subscribers-backend-powerpc

Author: Kai Luo (bzEq)

Changes

TOC_ENTRY node is created with {GA, Reg} operands, the pattern in ADDIStocHA is inconsistent.


Full diff: https://github.com/llvm/llvm-project/pull/93905.diff

1 Files Affected:

  • (modified) llvm/lib/Target/PowerPC/PPCInstrInfo.td (+1-1)
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index e3d6d2f094f2e..8697a98d7accb 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -3345,7 +3345,7 @@ def LWZtocL : PPCEmitTimePseudo<(outs gprc:$rD), (ins tocentry32:$disp, gprc_nor
 def ADDIStocHA : PPCEmitTimePseudo<(outs gprc:$rD), (ins gprc_nor0:$reg, tocentry32:$disp),
                        "#ADDIStocHA",
                        [(set i32:$rD,
-                         (PPCtoc_entry i32:$reg, tglobaladdr:$disp))]>;
+                         (PPCtoc_entry tglobaladdr:$disp, i32:$reg))]>;
 // TOC Data Transform on AIX
 def ADDItoc : PPCEmitTimePseudo<(outs gprc:$rD), (ins tocentry32:$disp, gprc:$reg),
                    "#ADDItoc",

@bzEq bzEq requested a review from amy-kwan May 31, 2024 00:37
@@ -3345,7 +3345,7 @@ def LWZtocL : PPCEmitTimePseudo<(outs gprc:$rD), (ins tocentry32:$disp, gprc_nor
def ADDIStocHA : PPCEmitTimePseudo<(outs gprc:$rD), (ins gprc_nor0:$reg, tocentry32:$disp),
"#ADDIStocHA",
[(set i32:$rD,
(PPCtoc_entry i32:$reg, tglobaladdr:$disp))]>;
(PPCtoc_entry tglobaladdr:$disp, i32:$reg))]>;
Copy link
Member

Choose a reason for hiding this comment

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

Since we need to transform the PPCtoc_entry node into 2 new nodes for large code model we do the transformation directly in PPCDAGToDAGISel::Select and so the match pattern here isn't used and can be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we confirm the pattern is not used? @bzEq I saw there are LIT changes...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the scheudling is changed. Since the machineinstr succeeds the attributes from the source SDAG node from the pattern. If the pattern is removed, the machineinstr loses these attributes. For PPCtoc_entry, the attributes are

SDNPMayLoad, SDNPMemOperand

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK. I think marking ADDIStocHA without load/store attributes is the right behavior.

@bzEq bzEq changed the title [PowerPC] Correct toc_entry pattern in ADDIStocHA [PowerPC] Remove pattern matching in ADDIStocHA Jun 1, 2024
@bzEq bzEq requested a review from mandlebug June 1, 2024 05:15
@bzEq bzEq force-pushed the correct-tocentry branch from c87d3a0 to cbfa6b6 Compare June 1, 2024 05:16
@bzEq bzEq changed the title [PowerPC] Remove pattern matching in ADDIStocHA [PowerPC] Remove DAG matching in ADDIStocHA Jun 1, 2024
Copy link
Member

@mandlebug mandlebug left a comment

Choose a reason for hiding this comment

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

LGTM.

@bzEq bzEq merged commit 4d20f49 into llvm:main Jun 4, 2024
7 checks passed
@bzEq bzEq deleted the correct-tocentry branch June 4, 2024 02:00
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.

4 participants