[llvm-commits] [poolalloc] r159602 - /poolalloc/trunk/lib/AssistDS/DSNodeEquivs.cpp

Matthew Wala mttjwl at gmail.com
Mon Jul 2 15:02:21 PDT 2012


Author: wala1
Date: Mon Jul  2 17:02:21 2012
New Revision: 159602

URL: http://llvm.org/viewvc/llvm-project?rev=159602&view=rev
Log:
Make some operations more efficient, as per John Criswell's suggestions.

Modified:
    poolalloc/trunk/lib/AssistDS/DSNodeEquivs.cpp

Modified: poolalloc/trunk/lib/AssistDS/DSNodeEquivs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/DSNodeEquivs.cpp?rev=159602&r1=159601&r2=159602&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/DSNodeEquivs.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/DSNodeEquivs.cpp Mon Jul  2 17:02:21 2012
@@ -249,10 +249,8 @@
       const User *TheUser = WL.front();
       WL.pop_front();
 
-      if (Visited.count(TheUser))
+      if (!Visited.insert(TheUser))
         continue;
-      else
-        Visited.insert(TheUser);
 
       //
       // If the use is a global variable or instruction, then the value should
@@ -261,9 +259,8 @@
       // TODO: Is it possible for a value to belong to some DSGraph and never
       // be relied upon by a GlobalValue or Instruction?
       //
-      if (isa<Instruction>(TheUser)) {
-        const Function *Parent =
-          cast<Instruction>(TheUser)->getParent()->getParent();
+      if (const Instruction *I = dyn_cast<Instruction>(TheUser)) {
+        const Function *Parent = I->getParent()->getParent();
         NHForV = &TDDS.getDSGraph(*Parent)->getNodeForValue(V);
         break;
       } else if (isa<GlobalValue>(TheUser)) {





More information about the llvm-commits mailing list