Do not ignore arg_size() impact while counting bb instructions.
authorDevang Patel <dpatel@apple.com>
Sat, 13 Mar 2010 01:05:02 +0000 (01:05 +0000)
committerDevang Patel <dpatel@apple.com>
Sat, 13 Mar 2010 01:05:02 +0000 (01:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98408 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InlineCost.cpp

index f14dc5d3478be0306d95eaa80a4c91d54d3fcd90..cf2ce0e06a7638cbc0f5db8f7d77997f7327e9c5 100644 (file)
@@ -142,7 +142,7 @@ static bool callIsSmall(const Function *F) {
 /// from the specified block.
 void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
   ++NumBlocks;
-  unsigned NumInstsInThisBB = 0;
+  unsigned NumInstsBeforeThisBB = NumInsts;
   for (BasicBlock::const_iterator II = BB->begin(), E = BB->end();
        II != E; ++II) {
     if (isa<PHINode>(II)) continue;           // PHI nodes don't count.
@@ -196,7 +196,6 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
     }
 
     ++NumInsts;
-    ++NumInstsInThisBB;
   }
   
   if (isa<ReturnInst>(BB->getTerminator()))
@@ -211,7 +210,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
     NeverInline = true;
 
   // Remember NumInsts for this BB.
-  NumBBInsts[BB] = NumInstsInThisBB;
+  NumBBInsts[BB] = NumInsts - NumInstsBeforeThisBB;
 }
 
 /// analyzeFunction - Fill in the current structure with information gleaned