[llvm] [ARM] Remove unneeded liveness check information (PR #87879)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 6 08:55:12 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: AtariDreams (AtariDreams)

<details>
<summary>Changes</summary>

We do not use that information, so let's stop calculating it.

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


1 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMConstantIslandPass.cpp (-17) 


``````````diff
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
index 7a3ba5870bc6df..c685cdfcf4ae9a 100644
--- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -989,13 +989,6 @@ void ARMConstantIslands::updateForInsertedWaterBlock(MachineBasicBlock *NewBB) {
 MachineBasicBlock *ARMConstantIslands::splitBlockBeforeInstr(MachineInstr *MI) {
   MachineBasicBlock *OrigBB = MI->getParent();
 
-  // Collect liveness information at MI.
-  LivePhysRegs LRs(*MF->getSubtarget().getRegisterInfo());
-  LRs.addLiveOuts(*OrigBB);
-  auto LivenessEnd = ++MachineBasicBlock::iterator(MI).getReverse();
-  for (MachineInstr &LiveMI : make_range(OrigBB->rbegin(), LivenessEnd))
-    LRs.stepBackward(LiveMI);
-
   // Create a new MBB for the code after the OrigBB.
   MachineBasicBlock *NewBB =
     MF->CreateMachineBasicBlock(OrigBB->getBasicBlock());
@@ -1024,12 +1017,6 @@ MachineBasicBlock *ARMConstantIslands::splitBlockBeforeInstr(MachineInstr *MI) {
   // OrigBB branches to NewBB.
   OrigBB->addSuccessor(NewBB);
 
-  // Update live-in information in the new block.
-  MachineRegisterInfo &MRI = MF->getRegInfo();
-  for (MCPhysReg L : LRs)
-    if (!MRI.isReserved(L))
-      NewBB->addLiveIn(L);
-
   // Update internal data structures to account for the newly inserted MBB.
   // This is almost the same as updateForInsertedWaterBlock, except that
   // the Water goes after OrigBB, not NewBB.
@@ -2497,10 +2484,6 @@ MachineBasicBlock *ARMConstantIslands::adjustJTTargetBlockForward(
   MachineFunction::iterator MBBI = ++JTBB->getIterator();
   MF->insert(MBBI, NewBB);
 
-  // Copy live-in information to new block.
-  for (const MachineBasicBlock::RegisterMaskPair &RegMaskPair : BB->liveins())
-    NewBB->addLiveIn(RegMaskPair);
-
   // Add an unconditional branch from NewBB to BB.
   // There doesn't seem to be meaningful DebugInfo available; this doesn't
   // correspond directly to anything in the source.

``````````

</details>


https://github.com/llvm/llvm-project/pull/87879


More information about the llvm-commits mailing list