mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
If a function is marked alwaysinline, it must be inlined (possibly for correctness). Do so even if the callee has dynamic alloca and the caller doesn't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3528e38fdf
commit
8c7848f17f
@ -224,6 +224,13 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS,
|
||||
if (CalleeFI.NeverInline)
|
||||
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
|
||||
// things we are going to just return always inline for. This
|
||||
// requires handling setjmp somewhere else, however.
|
||||
if (!Callee->isDeclaration() && Callee->hasFnAttr(Attribute::AlwaysInline))
|
||||
return InlineCost::getAlways();
|
||||
|
||||
if (CalleeFI.usesDynamicAlloca) {
|
||||
// Get infomation about the caller...
|
||||
FunctionInfo &CallerFI = CachedFunctionInfo[Caller];
|
||||
@ -239,13 +246,6 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS,
|
||||
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
|
||||
// things we are going to just return always inline for. This
|
||||
// requires handling setjmp somewhere else, however.
|
||||
if (!Callee->isDeclaration() && Callee->hasFnAttr(Attribute::AlwaysInline))
|
||||
return InlineCost::getAlways();
|
||||
|
||||
// Add to the inline quality for properties that make the call valuable to
|
||||
// inline. This includes factors that indicate that the result of inlining
|
||||
// the function will be optimizable. Currently this just looks at arguments
|
||||
|
15
test/Transforms/Inline/always_inline_dyn_alloca.ll
Normal file
15
test/Transforms/Inline/always_inline_dyn_alloca.ll
Normal file
@ -0,0 +1,15 @@
|
||||
; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
|
||||
; rdar://6655932
|
||||
|
||||
; If callee is marked alwaysinline, inline it! Even if callee has dynamic
|
||||
; alloca and caller does not,
|
||||
|
||||
define internal void @callee(i32 %N) alwaysinline {
|
||||
%P = alloca i32, i32 %N
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @foo(i32 %N) {
|
||||
call void @callee( i32 %N )
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user