[PATCH] D17475: MachineCopyPropagation: Catch copies of the form A<-B; A<-B

Jun Bum Lim via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 15:09:24 PST 2016


junbuml added inline comments.

================
Comment at: lib/CodeGen/MachineCopyPropagation.cpp:155
@@ +154,3 @@
+           : make_range(CopyMI->getIterator(), MI->getIterator()))
+        MMI.clearRegisterKills(Def, TRI);
+
----------------
Cleaning kill for Def is not always correct. In the second call for eraseRedundantCopy() below,  MI's Src is passed as the second parameter, which is Def here, but we need to clean kill for MI's Def instead of  MI's Src. 

================
Comment at: lib/CodeGen/MachineCopyPropagation.cpp:194
@@ +193,3 @@
+      // %RAX<def> = COPY %RSP
+      if (eraseRedundantCopy(MI, Src, Def))
+        continue;
----------------
Looks like the first eraseRedundantCopy() is for :

%A = COPY %B
      :
%B = COPY %A,
while the second eraseRedundantCopy() is for :

%A = COPY %B
      :
%A = COPY %B.
So, it will good to have comment for each.


Repository:
  rL LLVM

http://reviews.llvm.org/D17475





More information about the llvm-commits mailing list