Skip to content

[CodeGen] Remove dead hack for MIPS #148039

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Jul 10, 2025

All tests pass without it now.

@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2025

@llvm/pr-subscribers-backend-mips

@llvm/pr-subscribers-llvm-regalloc

Author: AZero13 (AZero13)

Changes

All tests pass without it now.


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

1 Files Affected:

  • (modified) llvm/lib/CodeGen/LiveVariables.cpp (-4)
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp
index 1f23418642bc6..e857ff665913a 100644
--- a/llvm/lib/CodeGen/LiveVariables.cpp
+++ b/llvm/lib/CodeGen/LiveVariables.cpp
@@ -534,10 +534,6 @@ void LiveVariables::runOnInstr(MachineInstr &MI,
         UseRegs.push_back(MOReg);
     } else {
       assert(MO.isDef());
-      // FIXME: We should not remove any dead flags. However the MIPS RDDSP
-      // instruction needs it at the moment: http://llvm.org/PR27116.
-      if (MOReg.isPhysical() && !MRI->isReserved(MOReg))
-        MO.setIsDead(false);
       DefRegs.push_back(MOReg);
     }
   }

@AZero13 AZero13 closed this Jul 10, 2025
@AZero13 AZero13 reopened this Jul 10, 2025
@AZero13 AZero13 requested a review from arsenm July 16, 2025 14:50
@AZero13
Copy link
Contributor Author

AZero13 commented Jul 16, 2025

@arsenm Thoughts?

@topperc
Copy link
Collaborator

topperc commented Jul 16, 2025

@arsenm Thoughts?

Are you able to explain why it is no longer needed? The code in MipsSEDAGToDAGISel::processFunctionAfterISel mentioned in http://llvm.org/PR27116 is still present.

This allows us to remove the hack that requires we remove the dead flag from the physical register.
Copy link

github-actions bot commented Jul 16, 2025

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

@AZero13 AZero13 marked this pull request as draft July 16, 2025 20:10
@@ -1579,6 +1626,10 @@ MipsTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
return emitSTR_W(MI, BB);
case Mips::STR_D:
return emitSTR_D(MI, BB);
case Mips::RDDSP_Pseudo:
Copy link
Collaborator

@topperc topperc Jul 16, 2025

Choose a reason for hiding this comment

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

EmitInstrWithCustomerInsert runs later than processFunctionAfterISel. How does this fix the problem?

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