summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2015-11-13 01:23:11 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2015-11-13 01:23:11 +0000
commitc7dfb76fe7f10ae66bc13529173aae510ff0dbd2 (patch)
tree53320d8ded19e24acab0096097fa2a487b8f4e2e /llvm/lib/Analysis
parent8bb168b1609f01e7e69bf7456e3e0450ac4dd74e (diff)
downloadbcm5719-llvm-c7dfb76fe7f10ae66bc13529173aae510ff0dbd2.tar.gz
bcm5719-llvm-c7dfb76fe7f10ae66bc13529173aae510ff0dbd2.zip
Provide a way to specify inliner's attribute compatibility and merging.
This reapplies r252949. I've changed the type of FuncName to be std::string instead of StringRef in emitFnAttrCompatCheck. Original commit message for r252949: Provide a way to specify inliner's attribute compatibility and merging rules using table-gen. NFC. This commit adds new classes CompatRule and MergeRule to Attributes.td, which are used to generate code to check attribute compatibility and merge attributes of the caller and callee. rdar://problem/19836465 llvm-svn: 252990
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 26f2e7ff504..b90843494b6 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -1349,22 +1349,13 @@ InlineCost InlineCostAnalysis::getInlineCost(CallSite CS, int Threshold) {
return getInlineCost(CS, CS.getCalledFunction(), Threshold);
}
-/// \brief Test that two functions either have or have not the given attribute
-/// at the same time.
-template<typename AttrKind>
-static bool attributeMatches(Function *F1, Function *F2, AttrKind Attr) {
- return F1->getFnAttribute(Attr) == F2->getFnAttribute(Attr);
-}
-
/// \brief Test that there are no attribute conflicts between Caller and Callee
/// that prevent inlining.
static bool functionsHaveCompatibleAttributes(Function *Caller,
Function *Callee,
TargetTransformInfo &TTI) {
return TTI.areInlineCompatible(Caller, Callee) &&
- attributeMatches(Caller, Callee, Attribute::SanitizeAddress) &&
- attributeMatches(Caller, Callee, Attribute::SanitizeMemory) &&
- attributeMatches(Caller, Callee, Attribute::SanitizeThread);
+ AttributeFuncs::areInlineCompatible(*Caller, *Callee);
}
InlineCost InlineCostAnalysis::getInlineCost(CallSite CS, Function *Callee,
OpenPOWER on IntegriCloud