Branch instructions don't produce values, so there's no need to generate a value...
authorOwen Anderson <resistor@mac.com>
Tue, 4 Jan 2011 18:54:18 +0000 (18:54 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 4 Jan 2011 18:54:18 +0000 (18:54 +0000)
avoids adding them to the various value numbering tables, resulting in a minor (~3%) speedup for GVN
on 40.gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122819 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index 43e850c65e8871d4be194232695d54229a37b1fd..cf82ebc027f805ae97fb483018d9e7761b6dedb2 100644 (file)
@@ -1670,14 +1670,9 @@ bool GVN::processInstruction(Instruction *I,
     return Changed;
   }
 
-  uint32_t NextNum = VN.getNextUnusedValueNumber();
-  unsigned Num = VN.lookup_or_add(I);
-
   // For conditions branches, we can perform simple conditional propagation on
   // the condition value itself.
   if (BranchInst *BI = dyn_cast<BranchInst>(I)) {
-    insert_table(Num, I, I->getParent());
-  
     if (!BI->isConditional() || isa<Constant>(BI->getCondition()))
       return false;
     
@@ -1699,6 +1694,9 @@ bool GVN::processInstruction(Instruction *I,
     return false;
   }
 
+  uint32_t NextNum = VN.getNextUnusedValueNumber();
+  unsigned Num = VN.lookup_or_add(I);
+
   // Allocations are always uniquely numbered, so we can save time and memory
   // by fast failing them.
   if (isa<AllocaInst>(I) || isa<TerminatorInst>(I) || isa<PHINode>(I)) {