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

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 6 08:54:37 PDT 2024


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

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

>From 813fedc7e79cfefc47c4ac3004b9e84be2097ead Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Sat, 6 Apr 2024 11:47:38 -0400
Subject: [PATCH] [ARM] Remove uneeded liveness check information

---
 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | 17 -----------------
 1 file changed, 17 deletions(-)

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.



More information about the llvm-commits mailing list