OSDN Git Service

[MemOperands] Clarify code around dropping memory operands [NFC]
authorPhilip Reames <listmail@philipreames.com>
Wed, 23 Dec 2015 19:16:04 +0000 (19:16 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 23 Dec 2015 19:16:04 +0000 (19:16 +0000)
Clarify a comment about what it means to drop memory operands from an instruction.  While I'm adding change the name of the method slightly to make it a bit more clear what's going on when reading calling code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256346 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/BranchFolding.cpp

index 93dc048..978864e 100644 (file)
@@ -1185,8 +1185,11 @@ public:
     assert(NumMemRefs == NewMemRefsEnd - NewMemRefs && "Too many memrefs");
   }
 
-  /// Clear this MachineInstr's memory reference descriptor list.
-  void clearMemRefs() {
+  /// Clear this MachineInstr's memory reference descriptor list.  This resets
+  /// the memrefs to their most conservative state.  This should be used only
+  /// as a last resort since it greatly pessimizes our knowledge of the memory
+  /// access performed by the instruction.
+  void dropMemRefs() {
     MemRefs = nullptr;
     NumMemRefs = 0;
   }
index e41926a..604feed 100644 (file)
@@ -793,7 +793,7 @@ removeMMOsFromMemoryOperations(MachineBasicBlock::iterator MBBIStartPos,
 
     if (MBBICommon->mayLoad() || MBBICommon->mayStore())
       if (!hasIdenticalMMOs(&*MBBI, &*MBBICommon))
-        MBBICommon->clearMemRefs();
+        MBBICommon->dropMemRefs();
 
     ++MBBI;
     ++MBBICommon;