Skip to content

[CodeGen] Remove LiveVariables::{isPHIJoin,setPHIJoin} #69128

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

Conversation

kazutakahirata
Copy link
Contributor

The last use of isPHIJoin was removed by:

commit fac770b
Author: Jakob Stoklund Olesen [email protected]
Date: Sat Feb 9 00:04:07 2013 +0000

so there is no reason to maintain PHIJoins.

The last use of isPHIJoin was removed by:

  commit fac770b
  Author: Jakob Stoklund Olesen <[email protected]>
  Date:   Sat Feb 9 00:04:07 2013 +0000

so there is no reason to maintain PHIJoins.
@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2023

@llvm/pr-subscribers-llvm-regalloc

Author: Kazu Hirata (kazutakahirata)

Changes

The last use of isPHIJoin was removed by:

commit fac770b
Author: Jakob Stoklund Olesen <[email protected]>
Date: Sat Feb 9 00:04:07 2013 +0000

so there is no reason to maintain PHIJoins.


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

3 Files Affected:

  • (modified) llvm/include/llvm/CodeGen/LiveVariables.h (-11)
  • (modified) llvm/lib/CodeGen/LiveVariables.cpp (-1)
  • (modified) llvm/lib/CodeGen/PHIElimination.cpp (-3)
diff --git a/llvm/include/llvm/CodeGen/LiveVariables.h b/llvm/include/llvm/CodeGen/LiveVariables.h
index 90aeb8ceda5590a..9ed4c7bdf7b1771 100644
--- a/llvm/include/llvm/CodeGen/LiveVariables.h
+++ b/llvm/include/llvm/CodeGen/LiveVariables.h
@@ -118,11 +118,6 @@ class LiveVariables : public MachineFunctionPass {
   ///
   IndexedMap<VarInfo, VirtReg2IndexFunctor> VirtRegInfo;
 
-  /// PHIJoins - list of virtual registers that are PHI joins. These registers
-  /// may have multiple definitions, and they require special handling when
-  /// building live intervals.
-  SparseBitVector<> PHIJoins;
-
 private:   // Intermediate data structures
   MachineFunction *MF = nullptr;
 
@@ -302,12 +297,6 @@ class LiveVariables : public MachineFunctionPass {
                    MachineBasicBlock *DomBB,
                    MachineBasicBlock *SuccBB,
                    std::vector<SparseBitVector<>> &LiveInSets);
-
-  /// isPHIJoin - Return true if Reg is a phi join register.
-  bool isPHIJoin(Register Reg) { return PHIJoins.test(Reg.id()); }
-
-  /// setPHIJoin - Mark Reg as a phi join register.
-  void setPHIJoin(Register Reg) { PHIJoins.set(Reg.id()); }
 };
 
 } // End llvm namespace
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp
index 077276b64aa2269..6b983b6320c711f 100644
--- a/llvm/lib/CodeGen/LiveVariables.cpp
+++ b/llvm/lib/CodeGen/LiveVariables.cpp
@@ -601,7 +601,6 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
   PhysRegDef.assign(NumRegs, nullptr);
   PhysRegUse.assign(NumRegs, nullptr);
   PHIVarInfo.resize(MF->getNumBlockIDs());
-  PHIJoins.clear();
 
   // FIXME: LiveIntervals will be updated to remove its dependence on
   // LiveVariables to improve compilation time and eliminate bizarre pass
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index dbb9a9ffdf60b53..10d8378ce58d1cf 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -330,9 +330,6 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
     if (IncomingReg) {
       LiveVariables::VarInfo &VI = LV->getVarInfo(IncomingReg);
 
-      // Increment use count of the newly created virtual register.
-      LV->setPHIJoin(IncomingReg);
-
       MachineInstr *OldKill = nullptr;
       bool IsPHICopyAfterOldKill = false;
 

@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff ea4cc2007efeaf14b8a07b967cb0c570e5b59d7c 4a7029a16b85909e9789832beb55f3da321f6e3a -- llvm/include/llvm/CodeGen/LiveVariables.h llvm/lib/CodeGen/LiveVariables.cpp llvm/lib/CodeGen/PHIElimination.cpp
View the diff from clang-format here.
diff --git a/llvm/include/llvm/CodeGen/LiveVariables.h b/llvm/include/llvm/CodeGen/LiveVariables.h
index 9ed4c7bdf..38c73390d 100644
--- a/llvm/include/llvm/CodeGen/LiveVariables.h
+++ b/llvm/include/llvm/CodeGen/LiveVariables.h
@@ -293,8 +293,7 @@ public:
                    MachineBasicBlock *DomBB,
                    MachineBasicBlock *SuccBB);
 
-  void addNewBlock(MachineBasicBlock *BB,
-                   MachineBasicBlock *DomBB,
+  void addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB,
                    MachineBasicBlock *SuccBB,
                    std::vector<SparseBitVector<>> &LiveInSets);
 };

@kazutakahirata
Copy link
Contributor Author

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:

git-clang-format --diff ea4cc2007efeaf14b8a07b967cb0c570e5b59d7c 4a7029a16b85909e9789832beb55f3da321f6e3a -- llvm/include/llvm/CodeGen/LiveVariables.h llvm/lib/CodeGen/LiveVariables.cpp llvm/lib/CodeGen/PHIElimination.cpp

View the diff from clang-format here.

diff --git a/llvm/include/llvm/CodeGen/LiveVariables.h b/llvm/include/llvm/CodeGen/LiveVariables.h
index 9ed4c7bdf..38c73390d 100644
--- a/llvm/include/llvm/CodeGen/LiveVariables.h
+++ b/llvm/include/llvm/CodeGen/LiveVariables.h
@@ -293,8 +293,7 @@ public:
                    MachineBasicBlock *DomBB,
                    MachineBasicBlock *SuccBB);
 
-  void addNewBlock(MachineBasicBlock *BB,
-                   MachineBasicBlock *DomBB,
+  void addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB,
                    MachineBasicBlock *SuccBB,
                    std::vector<SparseBitVector<>> &LiveInSets);
 };

I'm a bit reluctant to follow the clang-format suggestion because the suggestion is just outside the code I am touching.

Copy link
Collaborator

@dwblaikie dwblaikie left a comment

Choose a reason for hiding this comment

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

nice cleanup!

@kazutakahirata kazutakahirata merged commit 0b570ad into llvm:main Oct 16, 2023
@kazutakahirata kazutakahirata deleted the pr_cleanup_dead_function_isPHIJoin branch October 16, 2023 16:31
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.

3 participants