[PATCH] D20531: MachineCopyPropagation: remove some more copys when they are not needed

Jun Bum Lim via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 12:57:50 PDT 2016


junbuml added a subscriber: junbuml.

================
Comment at: lib/CodeGen/MachineCopyPropagation.cpp:272
@@ +271,3 @@
+            Clobbers.insert(*SR);
+            continue;
+          }
----------------
You may intended  this continue in outside of this for loop ? 
 

================
Comment at: lib/CodeGen/MachineCopyPropagation.cpp:278
@@ +277,3 @@
+        // register that is also in the right register class, use that
+        // earlier source register insted. This may make that previous
+        // copy removable. Skipping subregs and multiple uses for now.
----------------
insted -> instead

================
Comment at: lib/CodeGen/MachineCopyPropagation.cpp:285
@@ +284,3 @@
+            MachineInstr &PrevCopy = *CI->second;
+            MachineOperand &PrevCopySrc = PrevCopy.getOperand(1);
+            const TargetRegisterClass *RC =
----------------
I doubt if you can simply replace MO with PrevCopySrc whenever the register class is matched.  What if either MO or PrevCopySrc is reserved ? 

================
Comment at: lib/CodeGen/MachineCopyPropagation.cpp:332-335
@@ -304,2 +331,6 @@
 
+      if (Clobbers.count(Reg))
+        DEBUG(dbgs() << "MCP: Removing copy due to def: ";
+              MaybeDead->dump());
+      else if (RegMask && RegMask->clobbersPhysReg(Reg))
         DEBUG(dbgs() << "MCP: Removing copy due to regmask clobbering: ";
----------------
Cann't you use MI->definesRegister() here instead of tracking defs through Clobbers.


http://reviews.llvm.org/D20531





More information about the llvm-commits mailing list