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 {
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);
/// @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);
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'
//===----------------------------------------------------------------------===//
#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 \
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());
}
--- /dev/null
+; RUN: opt %s -inline -S | FileCheck %s
+; PR6682
+declare void @foo() nounwind
+
+define void @bar() nounwind {
+entry:
+ tail call void @foo() nounwind
+ ret void
+}
+
+define void @bazz() nounwind {
+entry:
+ tail call void @bar() nounwind noinline
+ ret void
+}
+
+; CHECK: define void @bazz()
+; CHECK: call void @bar()