[llvm] r290820 - NewGVN: Fix some formatting and comment issues

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 10:22:38 PST 2017


Author: dannyb
Date: Mon Jan  2 12:22:38 2017
New Revision: 290820

URL: http://llvm.org/viewvc/llvm-project?rev=290820&view=rev
Log:
NewGVN: Fix some formatting and comment issues

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

Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=290820&r1=290819&r2=290820&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Mon Jan  2 12:22:38 2017
@@ -780,12 +780,8 @@ const Expression *NewGVN::performSymboli
 // Update the memory access equivalence table to say that From is equal to To,
 // and return true if this is different from what already existed in the table.
 bool NewGVN::setMemoryAccessEquivTo(MemoryAccess *From, MemoryAccess *To) {
-  DEBUG(dbgs() << "Setting " << *From << " equivalent to ");
-  if (!To)
-    DEBUG(dbgs() << "itself");
-  else
-    DEBUG(dbgs() << *To);
-  DEBUG(dbgs() << "\n");
+  DEBUG(dbgs() << "Setting " << *From << " equivalent to "
+               << (To ? "itself" : *To) << "\n");
   auto LookupResult = MemoryAccessEquiv.find(From);
   bool Changed = false;
   // If it's already in the table, see if the value changed.
@@ -1092,16 +1088,11 @@ void NewGVN::performCongruenceFinding(Va
     if (auto *I = dyn_cast<Instruction>(V)) {
       if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) {
         // If this is a MemoryDef, we need to update the equivalence table. If
-        // we
-        // determined the expression is congruent to a different memory state,
-        // use that different memory state.  If we determined it didn't, we
-        // update
-        // that as well. Note that currently, we do not guarantee the
-        // "different" memory state dominates us.  The goal is to make things
-        // that are congruent look congruent, not ensure we can eliminate one in
-        // favor of the other.
+        // we determined the expression is congruent to a different memory
+        // state, use that different memory state.  If we determined it didn't,
+        // we update that as well.
         // Right now, the only way they can be equivalent is for store
-        // expresions.
+        // expressions.
         if (!isa<MemoryUse>(MA)) {
           if (E && isa<StoreExpression>(E) && EClass->Members.size() != 1) {
             auto *DefAccess = cast<StoreExpression>(E)->getDefiningAccess();
@@ -1391,7 +1382,7 @@ void NewGVN::valueNumberInstruction(Inst
   } else {
     // Handle terminators that return values. All of them produce values we
     // don't currently understand.
-    if (!I->getType()->isVoidTy()){
+    if (!I->getType()->isVoidTy()) {
       auto *Symbolized = createUnknownExpression(I);
       performCongruenceFinding(I, Symbolized);
     }
@@ -1588,7 +1579,6 @@ bool NewGVN::runGVN(Function &F, Dominat
     }
   }
 
-// FIXME: Move this to expensive checks when we are satisfied with NewGVN
 #ifndef NDEBUG
   verifyMemoryCongruency();
 #endif
@@ -2070,7 +2060,7 @@ bool NewGVN::eliminateInstructions(Funct
 
     // Cleanup the congruence class.
     SmallPtrSet<Value *, 4> MembersLeft;
-    for (Value * Member : CC->Members) {
+    for (Value *Member : CC->Members) {
       if (Member->getType()->isVoidTy()) {
         MembersLeft.insert(Member);
         continue;




More information about the llvm-commits mailing list