diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2015-11-12 20:59:43 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2015-11-12 20:59:43 +0000 |
commit | 61b81a563a3e8cdaa00ce10bc3b7f2c52598d2e7 (patch) | |
tree | 1b5e5a2fc085d5689728eff0ae585d6e9409cc1e /llvm/lib/Analysis/InlineCost.cpp | |
parent | 53da2fe7291e48131f380da2e6c7e8d232ad366d (diff) | |
download | llvm-61b81a563a3e8cdaa00ce10bc3b7f2c52598d2e7.zip llvm-61b81a563a3e8cdaa00ce10bc3b7f2c52598d2e7.tar.gz llvm-61b81a563a3e8cdaa00ce10bc3b7f2c52598d2e7.tar.bz2 |
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: 252949
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 26f2e7f..b908434 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, |