PEI: Only call updateLiveness once per function
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 18 Dec 2020 15:51:54 +0000 (10:51 -0500)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 18 Dec 2020 16:02:28 +0000 (11:02 -0500)
This only needs to be called once for the function, and it visits all
the necessary blocks in the function. It looks like
631f6b888c50276450fee8b9ef129f37f83fc5a1 accidentally moved this into
the loop over all save blocks.

llvm/lib/CodeGen/PrologEpilogInserter.cpp

index 9ae155a..7c38b19 100644 (file)
@@ -620,12 +620,12 @@ void PEI::spillCalleeSavedRegs(MachineFunction &MF) {
       if (!MFI.hasCalls())
         NumLeafFuncWithSpills++;
 
-      for (MachineBasicBlock *SaveBlock : SaveBlocks) {
+      for (MachineBasicBlock *SaveBlock : SaveBlocks)
         insertCSRSaves(*SaveBlock, CSI);
-        // Update the live-in information of all the blocks up to the save
-        // point.
-        updateLiveness(MF);
-      }
+
+      // Update the live-in information of all the blocks up to the save point.
+      updateLiveness(MF);
+
       for (MachineBasicBlock *RestoreBlock : RestoreBlocks)
         insertCSRRestores(*RestoreBlock, CSI);
     }