Revert test polarity to match comment and desired outcome. Remove undeserved bonus.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 26 Jan 2010 21:31:35 +0000 (21:31 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 26 Jan 2010 21:31:35 +0000 (21:31 +0000)
A GEP with all constant indices is already considered free by
analyzeBasicBlock(), so don't give it an extra bonus in
CountCodeReductionForAlloca().

This patch should remove a small positive bias toward inlining functions with
variable-index GEPs, and remove a smaller negative bias from functions with
all-constant index GEPs.

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

lib/Analysis/InlineCost.cpp

index ddf78a2ac0c4115349dabbd369f08ed111b8a152..a5a0a98f5a1f39b79699d5880eec5c6780189737 100644 (file)
@@ -87,8 +87,8 @@ unsigned InlineCostAnalyzer::FunctionInfo::
       Reduction += 10;
     else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) {
       // If the GEP has variable indices, we won't be able to do much with it.
-      if (!GEP->hasAllConstantIndices())
-        Reduction += CountCodeReductionForAlloca(GEP)+15;
+      if (GEP->hasAllConstantIndices())
+        Reduction += CountCodeReductionForAlloca(GEP);
     } else {
       // If there is some other strange instruction, we're not going to be able
       // to do much if we inline this.