[llvm] r267893 - [EarlyCSE] Change LoadValue field Value *Data to Instruction *Inst. NFC.

Geoff Berry via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 08:22:37 PDT 2016


Author: gberry
Date: Thu Apr 28 10:22:37 2016
New Revision: 267893

URL: http://llvm.org/viewvc/llvm-project?rev=267893&view=rev
Log:
[EarlyCSE] Change LoadValue field Value *Data to Instruction *Inst. NFC.

Made in preparation for adding MemorySSA support to EarlyCSE.

Modified:
    llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp?rev=267893&r1=267892&r2=267893&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp Thu Apr 28 10:22:37 2016
@@ -279,15 +279,15 @@ public:
   /// present the table; it is the responsibility of the consumer to inspect
   /// the atomicity/volatility if needed.
   struct LoadValue {
-    Value *Data;
+    Instruction *Inst;
     unsigned Generation;
     int MatchingId;
     bool IsAtomic;
     LoadValue()
-      : Data(nullptr), Generation(0), MatchingId(-1), IsAtomic(false) {}
-    LoadValue(Value *Data, unsigned Generation, unsigned MatchingId,
+      : Inst(nullptr), Generation(0), MatchingId(-1), IsAtomic(false) {}
+    LoadValue(Instruction *Inst, unsigned Generation, unsigned MatchingId,
               bool IsAtomic)
-      : Data(Data), Generation(Generation), MatchingId(MatchingId),
+      : Inst(Inst), Generation(Generation), MatchingId(MatchingId),
         IsAtomic(IsAtomic) {}
   };
   typedef RecyclingAllocator<BumpPtrAllocator,
@@ -597,16 +597,16 @@ bool EarlyCSE::processNode(DomTreeNode *
       // If we have an available version of this load, and if it is the right
       // generation, replace this instruction.
       LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand());
-      if (InVal.Data != nullptr && InVal.Generation == CurrentGeneration &&
+      if (InVal.Inst != nullptr && InVal.Generation == CurrentGeneration &&
           InVal.MatchingId == MemInst.getMatchingId() &&
           // We don't yet handle removing loads with ordering of any kind.
           !MemInst.isVolatile() && MemInst.isUnordered() &&
           // We can't replace an atomic load with one which isn't also atomic.
           InVal.IsAtomic >= MemInst.isAtomic()) {
-        Value *Op = getOrCreateResult(InVal.Data, Inst->getType());
+        Value *Op = getOrCreateResult(InVal.Inst, Inst->getType());
         if (Op != nullptr) {
           DEBUG(dbgs() << "EarlyCSE CSE LOAD: " << *Inst
-                       << "  to: " << *InVal.Data << '\n');
+                       << "  to: " << *InVal.Inst << '\n');
           if (!Inst->use_empty())
             Inst->replaceAllUsesWith(Op);
           Inst->eraseFromParent();
@@ -674,8 +674,8 @@ bool EarlyCSE::processNode(DomTreeNode *
     // the store originally was.
     if (MemInst.isValid() && MemInst.isStore()) {
       LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand());
-      if (InVal.Data &&
-          InVal.Data == getOrCreateResult(Inst, InVal.Data->getType()) &&
+      if (InVal.Inst &&
+          InVal.Inst == getOrCreateResult(Inst, InVal.Inst->getType()) &&
           InVal.Generation == CurrentGeneration &&
           InVal.MatchingId == MemInst.getMatchingId() &&
           // We don't yet handle removing stores with ordering of any kind.




More information about the llvm-commits mailing list