[PATCH] Remove all MMOs from memory operations when tail merging.

Chad Rosier mcrosier at codeaurora.org
Fri Mar 6 14:13:59 PST 2015


In addition to adding the == and != operators to MachineMemOperrand.h, this patch set 
address a few issues from the previous patch:

1. When comparing MMO Values, both being null is considered identical, per Hal's review.

2. When iterating over the MBB, only compare instructions in the common block against the equivalent instruction in the non-common block.  Previously, we were comparing all instruction in the common block against all instructions in the non-common block which can remove MMOs that are not necessary.

3. The "SameTails" can have CommonTailLen of different values relating to the same common block, and  might have different number of matching instructions and some extra debug instructions that have to be discounted.

Ana, please feel free to add additional comments.


================
Comment at: include/llvm/CodeGen/MachineMemOperand.h:204
@@ +203,3 @@
+  friend bool operator== (const MachineMemOperand &LHS, const MachineMemOperand &RHS) {
+    if (LHS.getValue() != RHS.getValue())
+      return false;
----------------
What about something like:
return LHS.getValue() == RHS.getValue() &&
         LHS.getPseudoValue() == RHS.getPseudoValue() &&
         LHS.getSize() != RHS.getSize() &&
         LHS.getOffset() != RHS.getOffset() &&
         ...
         ...;


================
Comment at: lib/CodeGen/BranchFolding.cpp:764
@@ +763,3 @@
+  while (CommonTailLen--) {
+    assert(MBBI != MBBIE && "Reached BB end within common tail length!");
+    (void)MBBIE;
----------------
Directly use MBB->rend(), rather than MBBIE?  This would remove the need for the void cast.

http://reviews.llvm.org/D7769

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list