[PATCH] D15913: Consolidate MemRefs handling from BranchFolding and correct latent bug

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 11:18:34 PST 2016


reames added inline comments.

================
Comment at: lib/CodeGen/BranchFolding.cpp:796
@@ -795,3 +784,1 @@
-      if (!hasIdenticalMMOs(&*MBBI, &*MBBICommon))
-        MBBICommon->dropMemRefs();
 
----------------
gberry wrote:
> I think dropMemRefs() is dead after this change, so it could also be removed.
Good catch.

================
Comment at: lib/CodeGen/MachineInstr.cpp:881
@@ +880,3 @@
+  if (NumMemRefs == Other.NumMemRefs &&
+      std::equal(memoperands_begin(), memoperands_end(),
+                 Other.memoperands_begin()))
----------------
gberry wrote:
> Isn't this going to do pointer equality comparisons instead of the MachineMemOperand::operator==() comparisons that hasIdenticalMMOs() was doing?  I don't think these are equivalent since as far as I can tell there is no uniqueing of MachineMemOperands done at creation.
Really good catch.  Yep, this was a bug on my part.  Will fix.  


http://reviews.llvm.org/D15913





More information about the llvm-commits mailing list