[llvm-commits] [llvm] r94591 - /llvm/trunk/lib/Analysis/InlineCost.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jan 26 13:31:35 PST 2010


Author: stoklund
Date: Tue Jan 26 15:31:35 2010
New Revision: 94591

URL: http://llvm.org/viewvc/llvm-project?rev=94591&view=rev
Log:
Revert test polarity to match comment and desired outcome. Remove undeserved bonus.

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.

Modified:
    llvm/trunk/lib/Analysis/InlineCost.cpp

Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=94591&r1=94590&r2=94591&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Tue Jan 26 15:31:35 2010
@@ -87,8 +87,8 @@
       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.





More information about the llvm-commits mailing list