[llvm] 5136f47 - CodeGen: Fix livein calculation in MachineBasicBlock splitAt

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 18:45:41 PDT 2020


Author: Carl Ritson
Date: 2020-10-02T10:45:04+09:00
New Revision: 5136f4748a2b3302da581f6140ca453bb37f11e9

URL: https://github.com/llvm/llvm-project/commit/5136f4748a2b3302da581f6140ca453bb37f11e9
DIFF: https://github.com/llvm/llvm-project/commit/5136f4748a2b3302da581f6140ca453bb37f11e9.diff

LOG: CodeGen: Fix livein calculation in MachineBasicBlock splitAt

Fix and simplify computation of liveins for new block.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D88535

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineBasicBlock.cpp
    llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 8a37a1e9d6f2..6272adcf114d 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -961,9 +961,10 @@ MachineBasicBlock *MachineBasicBlock::splitAt(MachineInstr &MI,
   if (UpdateLiveIns) {
     // Make sure we add any physregs we define in the block as liveins to the
     // new block.
+    MachineBasicBlock::iterator Prev(&MI);
     LiveRegs.init(*MF->getSubtarget().getRegisterInfo());
     LiveRegs.addLiveOuts(*this);
-    for (auto I = rbegin(), E = SplitPoint.getReverse(); I != E; ++I)
+    for (auto I = rbegin(), E = Prev.getReverse(); I != E; ++I)
       LiveRegs.stepBackward(*I);
   }
 

diff  --git a/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir b/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir
index cc86f5b267bb..57bedf7a7aa5 100644
--- a/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir
+++ b/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir
@@ -233,7 +233,6 @@ body:             |
   ; GCN:   $exec = S_OR_B64_term $exec, [[COPY3]], implicit-def $scc
   ; GCN: bb.3:
   ; GCN:   successors: %bb.2(0x80000000)
-  ; GCN:   liveins: $vgpr3
   ; GCN:   $vgpr3 = V_MOV_B32_e32 0, implicit $exec
   ; GCN:   $sgpr4_sgpr5 = S_MOV_B64 32
   ; GCN: bb.2:


        


More information about the llvm-commits mailing list