mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Check the alwaysinline attribute on the call as well as on the caller.
Differential Revision: http://reviews.llvm.org/D3815 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209150 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1259,7 +1259,7 @@ InlineCost InlineCostAnalysis::getInlineCost(CallSite CS, Function *Callee,
|
|||||||
|
|
||||||
// Calls to functions with always-inline attributes should be inlined
|
// Calls to functions with always-inline attributes should be inlined
|
||||||
// whenever possible.
|
// whenever possible.
|
||||||
if (Callee->hasFnAttribute(Attribute::AlwaysInline)) {
|
if (CS.hasFnAttr(Attribute::AlwaysInline)) {
|
||||||
if (isInlineViable(*Callee))
|
if (isInlineViable(*Callee))
|
||||||
return llvm::InlineCost::getAlways();
|
return llvm::InlineCost::getAlways();
|
||||||
return llvm::InlineCost::getNever();
|
return llvm::InlineCost::getNever();
|
||||||
|
|||||||
@@ -95,8 +95,7 @@ InlineCost AlwaysInliner::getInlineCost(CallSite CS) {
|
|||||||
// that are viable for inlining. FIXME: We shouldn't even get here for
|
// that are viable for inlining. FIXME: We shouldn't even get here for
|
||||||
// declarations.
|
// declarations.
|
||||||
if (Callee && !Callee->isDeclaration() &&
|
if (Callee && !Callee->isDeclaration() &&
|
||||||
Callee->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
CS.hasFnAttr(Attribute::AlwaysInline) &&
|
||||||
Attribute::AlwaysInline) &&
|
|
||||||
ICA->isInlineViable(*Callee))
|
ICA->isInlineViable(*Callee))
|
||||||
return InlineCost::getAlways();
|
return InlineCost::getAlways();
|
||||||
|
|
||||||
|
|||||||
@@ -122,3 +122,14 @@ entry:
|
|||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define i32 @inner7() {
|
||||||
|
ret i32 1
|
||||||
|
}
|
||||||
|
define i32 @outer7() {
|
||||||
|
; CHECK-LABEL: @outer7(
|
||||||
|
; CHECK-NOT: call
|
||||||
|
; CHECK: ret
|
||||||
|
|
||||||
|
%r = call i32 @inner7() alwaysinline
|
||||||
|
ret i32 %r
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user