diff options
| author | Dale Johannesen <dalej@apple.com> | 2009-01-09 01:30:11 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2009-01-09 01:30:11 +0000 |
| commit | 4755d9df786f8fd699fc4aee988c74af4c8ea8f6 (patch) | |
| tree | b996f491b4cbf0da17e925b4ec3137d355858254 /llvm/lib/Transforms/Utils | |
| parent | f4c6616d9dd65a0c364d80ade1dd5618457e8d82 (diff) | |
| download | bcm5719-llvm-4755d9df786f8fd699fc4aee988c74af4c8ea8f6.tar.gz bcm5719-llvm-4755d9df786f8fd699fc4aee988c74af4c8ea8f6.zip | |
Adjustments to last patch based on review.
llvm-svn: 61969
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/InlineCost.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineCost.cpp b/llvm/lib/Transforms/Utils/InlineCost.cpp index 82e310b38c4..90d72efa36d 100644 --- a/llvm/lib/Transforms/Utils/InlineCost.cpp +++ b/llvm/lib/Transforms/Utils/InlineCost.cpp @@ -127,7 +127,7 @@ void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) { } if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) { - if (!isa<ConstantInt>(AI->getArraySize())) + if (!AI->isStaticAlloca()) this->usesDynamicAlloca = true; } @@ -229,18 +229,20 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, if (CalleeFI.NeverInline) return InlineCost::getNever(); - // Get infomation about the caller... - FunctionInfo &CallerFI = CachedFunctionInfo[Caller]; + if (CalleeFI.usesDynamicAlloca) { + // Get infomation about the caller... + FunctionInfo &CallerFI = CachedFunctionInfo[Caller]; - // If we haven't calculated this information yet, do so now. - if (CallerFI.NumBlocks == 0) - CallerFI.analyzeFunction(Caller); + // If we haven't calculated this information yet, do so now. + if (CallerFI.NumBlocks == 0) + CallerFI.analyzeFunction(Caller); - // Don't inline a callee with dynamic alloca into a caller without them. - // Functions containing dynamic alloca's are inefficient in various ways; - // don't create more inefficiency. - if (CalleeFI.usesDynamicAlloca && !CallerFI.usesDynamicAlloca) - return InlineCost::getNever(); + // Don't inline a callee with dynamic alloca into a caller without them. + // Functions containing dynamic alloca's are inefficient in various ways; + // don't create more inefficiency. + if (!CallerFI.usesDynamicAlloca) + return InlineCost::getNever(); + } // FIXME: It would be nice to kill off CalleeFI.NeverInline. Then we // could move this up and avoid computing the FunctionInfo for |

