Hoisted some loop invariant smallvector lookups out of a MachineLICM loop
authorPete Cooper <peter_cooper@apple.com>
Thu, 22 Dec 2011 02:13:25 +0000 (02:13 +0000)
committerPete Cooper <peter_cooper@apple.com>
Thu, 22 Dec 2011 02:13:25 +0000 (02:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147127 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineLICM.cpp

index 3a8270002dde20c4fd85f9f5b86e9d93087df1b2..68548387976d19923d35b8e7882bfeb54908c7c8 100644 (file)
@@ -1036,9 +1036,11 @@ bool MachineLICM::CanCauseHighRegPressure(DenseMap<unsigned, int> &Cost) {
       continue;
 
     unsigned RCId = CI->first;
+    unsigned Limit = RegLimit[RCId];
+    int Cost = CI->second;
     for (unsigned i = BackTrace.size(); i != 0; --i) {
       SmallVector<unsigned, 8> &RP = BackTrace[i-1];
-      if (RP[RCId] + CI->second >= RegLimit[RCId])
+      if (RP[RCId] + Cost >= Limit)
         return true;
     }
   }