[llvm-commits] [llvm] r99483 - in /llvm/trunk: include/llvm/Instructions.h include/llvm/Support/CallSite.h lib/Analysis/InlineCost.cpp lib/VMCore/Instructions.cpp test/Transforms/Inline/noinline.ll
Eric Christopher
echristo at apple.com
Wed Mar 24 21:49:11 PDT 2010
Author: echristo
Date: Wed Mar 24 23:49:10 2010
New Revision: 99483
URL: http://llvm.org/viewvc/llvm-project?rev=99483&view=rev
Log:
Reapply r99451 with a fix to move the NoInline check to the cost functions
instead of InlineFunction.
Added:
llvm/trunk/test/Transforms/Inline/noinline.ll
- copied unchanged from r99450, llvm/trunk/test/Transforms/Inline/noinline.ll
Modified:
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/Support/CallSite.h
llvm/trunk/lib/Analysis/InlineCost.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=99483&r1=99482&r2=99483&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Wed Mar 24 23:49:10 2010
@@ -971,6 +971,13 @@
unsigned getParamAlignment(unsigned i) const {
return AttributeList.getParamAlignment(i);
}
+
+ /// @brief Return true if the call should not be inlined.
+ bool isNoInline() const { return paramHasAttr(~0, Attribute::NoInline); }
+ void setIsNoInline(bool Value) {
+ if (Value) addAttribute(~0, Attribute::NoInline);
+ else removeAttribute(~0, Attribute::NoInline);
+ }
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
@@ -2456,6 +2463,13 @@
return AttributeList.getParamAlignment(i);
}
+ /// @brief Return true if the call should not be inlined.
+ bool isNoInline() const { return paramHasAttr(~0, Attribute::NoInline); }
+ void setIsNoInline(bool Value) {
+ if (Value) addAttribute(~0, Attribute::NoInline);
+ else removeAttribute(~0, Attribute::NoInline);
+ }
+
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
return paramHasAttr(~0, Attribute::ReadNone);
Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=99483&r1=99482&r2=99483&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Wed Mar 24 23:49:10 2010
@@ -76,6 +76,10 @@
/// @brief Extract the alignment for a call or parameter (0=unknown).
uint16_t getParamAlignment(uint16_t i) const;
+ /// @brief Return true if the call should not be inlined.
+ bool isNoInline() const;
+ void setIsNoInline(bool Value = true);
+
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const;
void setDoesNotAccessMemory(bool doesNotAccessMemory = true);
Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=99483&r1=99482&r2=99483&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Wed Mar 24 23:49:10 2010
@@ -255,9 +255,11 @@
Function *Caller = TheCall->getParent()->getParent();
// Don't inline functions which can be redefined at link-time to mean
- // something else. Don't inline functions marked noinline.
+ // something else. Don't inline functions marked noinline or call sites
+ // marked noinline.
if (Callee->mayBeOverridden() ||
- Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee))
+ Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee) ||
+ CS.isNoInline())
return llvm::InlineCost::getNever();
// InlineCost - This value measures how good of an inline candidate this call
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=99483&r1=99482&r2=99483&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Wed Mar 24 23:49:10 2010
@@ -31,13 +31,13 @@
//===----------------------------------------------------------------------===//
#define CALLSITE_DELEGATE_GETTER(METHOD) \
- Instruction *II(getInstruction()); \
+ Instruction *II = getInstruction(); \
return isCall() \
? cast<CallInst>(II)->METHOD \
: cast<InvokeInst>(II)->METHOD
#define CALLSITE_DELEGATE_SETTER(METHOD) \
- Instruction *II(getInstruction()); \
+ Instruction *II = getInstruction(); \
if (isCall()) \
cast<CallInst>(II)->METHOD; \
else \
@@ -66,6 +66,17 @@
uint16_t CallSite::getParamAlignment(uint16_t i) const {
CALLSITE_DELEGATE_GETTER(getParamAlignment(i));
}
+
+/// @brief Return true if the call should not be inlined.
+bool CallSite::isNoInline() const {
+ CALLSITE_DELEGATE_GETTER(isNoInline());
+}
+
+void CallSite::setIsNoInline(bool Value) {
+ CALLSITE_DELEGATE_GETTER(setIsNoInline(Value));
+}
+
+
bool CallSite::doesNotAccessMemory() const {
CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
}
More information about the llvm-commits
mailing list