Index: llvm/trunk/lib/Analysis/IPA/InlineCost.cpp =================================================================== --- llvm/trunk/lib/Analysis/IPA/InlineCost.cpp +++ llvm/trunk/lib/Analysis/IPA/InlineCost.cpp @@ -1259,7 +1259,7 @@ // Calls to functions with always-inline attributes should be inlined // whenever possible. - if (Callee->hasFnAttribute(Attribute::AlwaysInline)) { + if (CS.hasFnAttr(Attribute::AlwaysInline)) { if (isInlineViable(*Callee)) return llvm::InlineCost::getAlways(); return llvm::InlineCost::getNever(); Index: llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp +++ llvm/trunk/lib/Transforms/IPO/InlineAlways.cpp @@ -95,8 +95,7 @@ // that are viable for inlining. FIXME: We shouldn't even get here for // declarations. if (Callee && !Callee->isDeclaration() && - Callee->getAttributes().hasAttribute(AttributeSet::FunctionIndex, - Attribute::AlwaysInline) && + CS.hasFnAttr(Attribute::AlwaysInline) && ICA->isInlineViable(*Callee)) return InlineCost::getAlways(); Index: llvm/trunk/test/Transforms/Inline/always-inline.ll =================================================================== --- llvm/trunk/test/Transforms/Inline/always-inline.ll +++ llvm/trunk/test/Transforms/Inline/always-inline.ll @@ -122,3 +122,14 @@ 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 +}