[llvm] bf6744d - [SystemZ] Use LivePhysRegs instead of isCCLiveOut() in SystemZElimCompare.cpp

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 07:23:40 PST 2019


Author: Jonas Paulsson
Date: 2019-11-04T16:22:00+01:00
New Revision: bf6744dfb244dbd2a4abe635f57e45218292743f

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

LOG: [SystemZ]  Use LivePhysRegs instead of isCCLiveOut() in SystemZElimCompare.cpp

Review: Ulrich Weigand
https://reviews.llvm.org/D68267

Added: 
    

Modified: 
    llvm/lib/Target/SystemZ/SystemZElimCompare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp b/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp
index 946eb2ba7c79..90f664a7f796 100644
--- a/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp
@@ -18,6 +18,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/CodeGen/LivePhysRegs.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
@@ -103,14 +104,6 @@ char SystemZElimCompare::ID = 0;
 
 } // end anonymous namespace
 
-// Return true if CC is live out of MBB.
-static bool isCCLiveOut(MachineBasicBlock &MBB) {
-  for (auto SI = MBB.succ_begin(), SE = MBB.succ_end(); SI != SE; ++SI)
-    if ((*SI)->isLiveIn(SystemZ::CC))
-      return true;
-  return false;
-}
-
 // Returns true if MI is an instruction whose output equals the value in Reg.
 static bool preservesValueOf(MachineInstr &MI, unsigned Reg) {
   switch (MI.getOpcode()) {
@@ -595,7 +588,9 @@ bool SystemZElimCompare::processBlock(MachineBasicBlock &MBB) {
   // Walk backwards through the block looking for comparisons, recording
   // all CC users as we go.  The subroutines can delete Compare and
   // instructions before it.
-  bool CompleteCCUsers = !isCCLiveOut(MBB);
+  LivePhysRegs LiveRegs(*TRI);
+  LiveRegs.addLiveOuts(MBB);
+  bool CompleteCCUsers = !LiveRegs.contains(SystemZ::CC);
   SmallVector<MachineInstr *, 4> CCUsers;
   MachineBasicBlock::iterator MBBI = MBB.end();
   while (MBBI != MBB.begin()) {


        


More information about the llvm-commits mailing list