summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-26 22:40:28 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-26 22:40:28 +0000
commitd67defdfe27efccb290d477a40efc5c57fce5d62 (patch)
tree11f522f40a2c78aeb176c2e3751f83b019b257ee /llvm
parent23f6626262895d5307e2398e3377dc38c978ea43 (diff)
downloadbcm5719-llvm-d67defdfe27efccb290d477a40efc5c57fce5d62.tar.gz
bcm5719-llvm-d67defdfe27efccb290d477a40efc5c57fce5d62.zip
Avoid counting InlineAsm as a call - it prevents loop unrolling.
PR7026 Patch by Pekka Jääskeläinen! llvm-svn: 104780
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 10c2d79bef3..98dbb69fe6a 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -175,7 +175,11 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
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;
}
}
OpenPOWER on IntegriCloud