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

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed May 26 15:40:28 PDT 2010


Author: stoklund
Date: Wed May 26 17:40:28 2010
New Revision: 104780

URL: http://llvm.org/viewvc/llvm-project?rev=104780&view=rev
Log:
Avoid counting InlineAsm as a call - it prevents loop unrolling.
PR7026
Patch by Pekka Jääskeläinen!

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=104780&r1=104779&r2=104780&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Wed May 26 17:40:28 2010
@@ -175,7 +175,11 @@
       if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction())) {
         // Each argument to a call takes on average one instruction to set up.
         NumInsts += CS.arg_size();
-        ++NumCalls;
+
+        // We don't want inline asm to count as a call - that would prevent loop
+        // unrolling. The argument setup cost is still real, though.
+        if (!isa<InlineAsm>(CS.getCalledValue()))
+          ++NumCalls;
       }
     }
     





More information about the llvm-commits mailing list