Skip to content

[Hexagon] Mark instructions as part of the frame setup to fix test sugared-constants.ll #111795

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 1 commit into from
Oct 14, 2024

Conversation

pkarveti
Copy link
Contributor

Added .setMIFlag(MachineInstr::FrameSetup) to all BuildMI calls in HexagonFrameLowering::insertAllocframe. This change ensures that the test sugared-constants.ll passes upstream by correctly marking instructions as part of the frame setup.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2024

@llvm/pr-subscribers-backend-hexagon

Author: None (pkarveti)

Changes

Added .setMIFlag(MachineInstr::FrameSetup) to all BuildMI calls in HexagonFrameLowering::insertAllocframe. This change ensures that the test sugared-constants.ll passes upstream by correctly marking instructions as part of the frame setup.


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

2 Files Affected:

  • (modified) llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp (+13-10)
  • (modified) llvm/test/DebugInfo/Generic/sugared-constants.ll (-4)
diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
index 05357de40e3a93..7c82f5e9f9a604 100644
--- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -906,22 +906,25 @@ void HexagonFrameLowering::insertAllocframe(MachineBasicBlock &MBB,
   if (NumBytes >= ALLOCFRAME_MAX) {
     // Emit allocframe(#0).
     BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::S2_allocframe))
-      .addDef(SP)
-      .addReg(SP)
-      .addImm(0)
-      .addMemOperand(MMO);
+        .addDef(SP)
+        .addReg(SP)
+        .addImm(0)
+        .addMemOperand(MMO)
+        .setMIFlag(MachineInstr::FrameSetup);
 
     // Subtract the size from the stack pointer.
     Register SP = HRI.getStackRegister();
     BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::A2_addi), SP)
-      .addReg(SP)
-      .addImm(-int(NumBytes));
+        .addReg(SP)
+        .addImm(-int(NumBytes))
+        .setMIFlag(MachineInstr::FrameSetup);
   } else {
     BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::S2_allocframe))
-      .addDef(SP)
-      .addReg(SP)
-      .addImm(NumBytes)
-      .addMemOperand(MMO);
+        .addDef(SP)
+        .addReg(SP)
+        .addImm(NumBytes)
+        .addMemOperand(MMO)
+        .setMIFlag(MachineInstr::FrameSetup);
   }
 }
 
diff --git a/llvm/test/DebugInfo/Generic/sugared-constants.ll b/llvm/test/DebugInfo/Generic/sugared-constants.ll
index c8ee035dbca1dc..221586fd1bc6f9 100644
--- a/llvm/test/DebugInfo/Generic/sugared-constants.ll
+++ b/llvm/test/DebugInfo/Generic/sugared-constants.ll
@@ -1,7 +1,3 @@
-; xfail this test on hexagon because upstream llc is not emitting the
-; correct DWARF info. Downstream llc is.
-; XFAIL: target=hexagon-{{.*}}
-
 ; RUN: %llc_dwarf -O0 -filetype=obj %s -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s
 ; Use correct signedness when emitting constants of derived (sugared) types.
 

@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2024

@llvm/pr-subscribers-debuginfo

Author: None (pkarveti)

Changes

Added .setMIFlag(MachineInstr::FrameSetup) to all BuildMI calls in HexagonFrameLowering::insertAllocframe. This change ensures that the test sugared-constants.ll passes upstream by correctly marking instructions as part of the frame setup.


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

2 Files Affected:

  • (modified) llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp (+13-10)
  • (modified) llvm/test/DebugInfo/Generic/sugared-constants.ll (-4)
diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
index 05357de40e3a93..7c82f5e9f9a604 100644
--- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -906,22 +906,25 @@ void HexagonFrameLowering::insertAllocframe(MachineBasicBlock &MBB,
   if (NumBytes >= ALLOCFRAME_MAX) {
     // Emit allocframe(#0).
     BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::S2_allocframe))
-      .addDef(SP)
-      .addReg(SP)
-      .addImm(0)
-      .addMemOperand(MMO);
+        .addDef(SP)
+        .addReg(SP)
+        .addImm(0)
+        .addMemOperand(MMO)
+        .setMIFlag(MachineInstr::FrameSetup);
 
     // Subtract the size from the stack pointer.
     Register SP = HRI.getStackRegister();
     BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::A2_addi), SP)
-      .addReg(SP)
-      .addImm(-int(NumBytes));
+        .addReg(SP)
+        .addImm(-int(NumBytes))
+        .setMIFlag(MachineInstr::FrameSetup);
   } else {
     BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::S2_allocframe))
-      .addDef(SP)
-      .addReg(SP)
-      .addImm(NumBytes)
-      .addMemOperand(MMO);
+        .addDef(SP)
+        .addReg(SP)
+        .addImm(NumBytes)
+        .addMemOperand(MMO)
+        .setMIFlag(MachineInstr::FrameSetup);
   }
 }
 
diff --git a/llvm/test/DebugInfo/Generic/sugared-constants.ll b/llvm/test/DebugInfo/Generic/sugared-constants.ll
index c8ee035dbca1dc..221586fd1bc6f9 100644
--- a/llvm/test/DebugInfo/Generic/sugared-constants.ll
+++ b/llvm/test/DebugInfo/Generic/sugared-constants.ll
@@ -1,7 +1,3 @@
-; xfail this test on hexagon because upstream llc is not emitting the
-; correct DWARF info. Downstream llc is.
-; XFAIL: target=hexagon-{{.*}}
-
 ; RUN: %llc_dwarf -O0 -filetype=obj %s -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s
 ; Use correct signedness when emitting constants of derived (sugared) types.
 

@androm3da
Copy link
Member

The commit message should probably change - instead of describing the problem, it's ideal to describe the change and/or the motivation for the change. Upstream versus downstream is somewhat irrelevant, this repo is this repo.

s/[Hexagon] test sugared-constants.ll fails upstream but works downstream/[Hexagon] fix sugared-constants.ll/

Or maybe a better commit message subject line would be [hexagon] Mark instructions as part of the frame setup?

But the change LGTM

@pkarveti pkarveti changed the title [Hexagon] test sugared-constants.ll fails upstream but works downstream [Hexagon] Mark instructions as part of the frame setup to fix test sugared-constants.ll Oct 11, 2024
Added .setMIFlag(MachineInstr::FrameSetup) to all BuildMI calls in
HexagonFrameLowering::insertAllocframe. This change ensures that the
test sugared-constants.ll passes upstream by correctly marking
instructions as part of the frame setup.
@iajbar iajbar self-requested a review October 11, 2024 13:55
@iajbar iajbar merged commit 81fee74 into llvm:main Oct 14, 2024
7 checks passed
Copy link

@pkarveti Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
…gared-constants.ll (llvm#111795)

Added .setMIFlag(MachineInstr::FrameSetup) to all BuildMI calls in
HexagonFrameLowering::insertAllocframe. This change ensures that the
test sugared-constants.ll passes upstream by correctly marking
instructions as part of the frame setup.
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