[llvm] r297047 - NewGVN: Remove DebugUnknownExprs, just mark the instructions as unused

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 10:42:39 PST 2017


Author: dannyb
Date: Mon Mar  6 12:42:39 2017
New Revision: 297047

URL: http://llvm.org/viewvc/llvm-project?rev=297047&view=rev
Log:
NewGVN: Remove DebugUnknownExprs, just mark the instructions as unused

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=297047&r1=297046&r2=297047&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Mon Mar  6 12:42:39 2017
@@ -289,8 +289,6 @@ class NewGVN : public FunctionPass {
   // Deletion info.
   SmallPtrSet<Instruction *, 8> InstructionsToErase;
 
-  // The set of things we gave unknown expressions to due to debug counting.
-  SmallPtrSet<Instruction *, 8> DebugUnknownExprs;
 public:
   static char ID; // Pass identification, replacement for typeid.
   NewGVN() : FunctionPass(ID) {
@@ -1718,7 +1716,6 @@ void NewGVN::cleanupTables() {
   DominatedInstRange.clear();
   MemoryAccessToClass.clear();
   PredicateToUsers.clear();
-  DebugUnknownExprs.clear();
 }
 
 std::pair<unsigned, unsigned> NewGVN::assignDFSNumbers(BasicBlock *B,
@@ -1815,9 +1812,8 @@ void NewGVN::valueNumberInstruction(Inst
     if (DebugCounter::shouldExecute(VNCounter)) {
       Symbolized = performSymbolicEvaluation(I);
     } else {
-      // Used to track which we marked unknown so we can skip verification of
-      // comparisons.
-      DebugUnknownExprs.insert(I);
+      // Mark the instruction as unused so we don't value number it again.
+      InstrDFS[I] = 0;
     }
     // If we couldn't come up with a symbolic expression, use the unknown
     // expression
@@ -1934,7 +1930,7 @@ void NewGVN::verifyComparisons(Function
     if (!ReachableBlocks.count(&BB))
       continue;
     for (auto &I : BB) {
-      if (InstructionsToErase.count(&I) || DebugUnknownExprs.count(&I))
+      if (InstrDFS.lookup(&I) == 0)
         continue;
       if (isa<CmpInst>(&I)) {
         auto *CurrentVal = ValueToClass.lookup(&I);




More information about the llvm-commits mailing list