aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-23 22:59:07 +0000
committerChris Lattner <sabre@nondot.org>2010-03-23 22:59:07 +0000
commit978986c455c8c6b91328a5caa952b0806f212078 (patch)
tree840df7c6eee7773d11a40219125eccd77714da57 /lib
parent1296c8c5a5aa965e377f011b4b3d742b3a80f9f8 (diff)
downloadexternal_llvm-978986c455c8c6b91328a5caa952b0806f212078.zip
external_llvm-978986c455c8c6b91328a5caa952b0806f212078.tar.gz
external_llvm-978986c455c8c6b91328a5caa952b0806f212078.tar.bz2
add some accessors to callsite/callinst/invokeinst to check
for the noinline attribute, and make the inliner refuse to inline a call site when the call site is marked noinline even if the callee isn't. This fixes PR6682. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp4
-rw-r--r--lib/VMCore/Instructions.cpp15
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 17f8827..599fe33 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -229,7 +229,9 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD,
const Function *CalledFunc = CS.getCalledFunction();
if (CalledFunc == 0 || // Can't inline external function or indirect
CalledFunc->isDeclaration() || // call, or call to a vararg function!
- CalledFunc->getFunctionType()->isVarArg()) return false;
+ CalledFunc->getFunctionType()->isVarArg() ||
+ CS.isNoInline()) // Call site is marked noinline.
+ return false;
// If the call to the callee is not a tail call, we must clear the 'tail'
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index ba749bc..b6d9ec2 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -31,13 +31,13 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
#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 @@ bool CallSite::paramHasAttr(uint16_t i, Attributes attr) const {
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());
}