Make val_replace fail early, which reduces the time to optimize 403.gcc to 14.8s.
authorOwen Anderson <resistor@mac.com>
Thu, 19 Jul 2007 19:57:13 +0000 (19:57 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 19 Jul 2007 19:57:13 +0000 (19:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40064 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVNPRE.cpp

index 69e5f733f731a17bc93a87325759450d75573754..9c7c8c2e2593a128593a7cc187fe561a51b7c9d1 100644 (file)
@@ -757,6 +757,8 @@ void GVNPRE::val_insert(ValueNumberedSet& s, Value* v) {
 /// val_replace - Insert a value into a set, replacing any values already in
 /// the set that have the same value number
 void GVNPRE::val_replace(ValueNumberedSet& s, Value* v) {
+  if (s.count(v)) return;
+  
   uint32_t num = VN.lookup(v);
   Value* leader = find_leader(s, num);
   if (leader != 0)