[llvm] r294851 - NewGVN: Reverse sense of this test to make it clearer

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 11 07:20:15 PST 2017


Author: dannyb
Date: Sat Feb 11 09:20:15 2017
New Revision: 294851

URL: http://llvm.org/viewvc/llvm-project?rev=294851&view=rev
Log:
NewGVN: Reverse sense of this test to make it clearer

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=294851&r1=294850&r2=294851&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Sat Feb 11 09:20:15 2017
@@ -1450,11 +1450,13 @@ void NewGVN::initializeCongruenceClasses
       MemoryAccessToClass[MP] = InitialClass;
 
     for (auto &I : B) {
-      // Don't insert void terminators into the class
-      if (!isa<TerminatorInst>(I) || !I.getType()->isVoidTy()) {
-        InitialValues.insert(&I);
-        ValueToClass[&I] = InitialClass;
-      }
+      // Don't insert void terminators into the class. We don't value number
+      // them, and they just end up sitting in INITIAL.
+      if (isa<TerminatorInst>(I) && I.getType()->isVoidTy())
+        continue;
+      InitialValues.insert(&I);
+      ValueToClass[&I] = InitialClass;
+
       // All memory accesses are equivalent to live on entry to start. They must
       // be initialized to something so that initial changes are noticed. For
       // the maximal answer, we initialize them all to be the same as




More information about the llvm-commits mailing list