[llvm] r293323 - ScheduleDAGInstrs: Cleanup toggleKillFlag(); NFC

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 10:53:05 PST 2017


Author: matze
Date: Fri Jan 27 12:53:05 2017
New Revision: 293323

URL: http://llvm.org/viewvc/llvm-project?rev=293323&view=rev
Log:
ScheduleDAGInstrs: Cleanup toggleKillFlag(); NFC

Modified:
    llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
    llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp

Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h?rev=293323&r1=293322&r2=293323&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h Fri Jan 27 12:53:05 2017
@@ -328,7 +328,7 @@ namespace llvm {
     ///
     /// Other adjustments may be made to the instruction if necessary. Return
     /// true if the operand has been deleted, false if not.
-    bool toggleKillFlag(MachineInstr *MI, MachineOperand &MO);
+    void toggleKillFlag(MachineInstr &MI, MachineOperand &MO);
 
     /// Returns a mask for which lanes get read/written by the given (register)
     /// machine operand.

Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=293323&r1=293322&r2=293323&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Fri Jan 27 12:53:05 2017
@@ -1154,32 +1154,32 @@ static void toggleBundleKillFlag(Machine
       if ((--End)->addRegisterKilled(Reg, TRI, /* addIfNotFound= */ false))
          return;
     } else
-        (--End)->clearRegisterKills(Reg, TRI);
+      (--End)->clearRegisterKills(Reg, TRI);
   }
 }
 
-bool ScheduleDAGInstrs::toggleKillFlag(MachineInstr *MI, MachineOperand &MO) {
+void ScheduleDAGInstrs::toggleKillFlag(MachineInstr &MI, MachineOperand &MO) {
   // Setting kill flag...
   if (!MO.isKill()) {
     MO.setIsKill(true);
-    toggleBundleKillFlag(MI, MO.getReg(), true, TRI);
-    return false;
+    toggleBundleKillFlag(&MI, MO.getReg(), true, TRI);
+    return;
   }
 
   // If MO itself is live, clear the kill flag...
   if (LiveRegs.test(MO.getReg())) {
     MO.setIsKill(false);
-    toggleBundleKillFlag(MI, MO.getReg(), false, TRI);
-    return false;
+    toggleBundleKillFlag(&MI, MO.getReg(), false, TRI);
+    return;
   }
 
   // If any subreg of MO is live, then create an imp-def for that
   // subreg and keep MO marked as killed.
   MO.setIsKill(false);
-  toggleBundleKillFlag(MI, MO.getReg(), false, TRI);
+  toggleBundleKillFlag(&MI, MO.getReg(), false, TRI);
   bool AllDead = true;
   const unsigned SuperReg = MO.getReg();
-  MachineInstrBuilder MIB(MF, MI);
+  MachineInstrBuilder MIB(MF, &MI);
   for (MCSubRegIterator SubRegs(SuperReg, TRI); SubRegs.isValid(); ++SubRegs) {
     if (LiveRegs.test(*SubRegs)) {
       MIB.addReg(*SubRegs, RegState::ImplicitDefine);
@@ -1189,9 +1189,8 @@ bool ScheduleDAGInstrs::toggleKillFlag(M
 
   if(AllDead) {
     MO.setIsKill(true);
-    toggleBundleKillFlag(MI, MO.getReg(), true, TRI);
+    toggleBundleKillFlag(&MI, MO.getReg(), true, TRI);
   }
-  return false;
 }
 
 void ScheduleDAGInstrs::fixupKills(MachineBasicBlock *MBB) {
@@ -1265,7 +1264,7 @@ void ScheduleDAGInstrs::fixupKills(Machi
 
       if (MO.isKill() != kill) {
         DEBUG(dbgs() << "Fixing " << MO << " in ");
-        toggleKillFlag(&MI, MO);
+        toggleKillFlag(MI, MO);
         DEBUG(MI.dump());
         DEBUG({
           if (MI.getOpcode() == TargetOpcode::BUNDLE) {




More information about the llvm-commits mailing list