diff options
| author | Eric Christopher <echristo@gmail.com> | 2015-07-02 01:11:47 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2015-07-02 01:11:47 +0000 |
| commit | 4371b13937ecdd881da0eb3550af370ec4c3d5a2 (patch) | |
| tree | e85bde8084b5ebbab3f6cfa1c545344f6e3bf0cf /llvm/lib | |
| parent | 41acb316232728a8495af291db57f70338582d6c (diff) | |
| download | llvm-4371b13937ecdd881da0eb3550af370ec4c3d5a2.zip llvm-4371b13937ecdd881da0eb3550af370ec4c3d5a2.tar.gz llvm-4371b13937ecdd881da0eb3550af370ec4c3d5a2.tar.bz2 | |
Add a routine to TargetTransformInfo that will allow targets to look
at the attributes on a function to determine whether or not to allow
inlining.
llvm-svn: 241220
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/IPA/InlineCost.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/Analysis/TargetTransformInfo.cpp | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/IPA/InlineCost.cpp b/llvm/lib/Analysis/IPA/InlineCost.cpp index 5ae7d44..349b9ca 100644 --- a/llvm/lib/Analysis/IPA/InlineCost.cpp +++ b/llvm/lib/Analysis/IPA/InlineCost.cpp @@ -1344,9 +1344,9 @@ static bool attributeMatches(Function *F1, Function *F2, AttrKind Attr) { /// \brief Test that there are no attribute conflicts between Caller and Callee /// that prevent inlining. static bool functionsHaveCompatibleAttributes(Function *Caller, - Function *Callee) { - return attributeMatches(Caller, Callee, "target-cpu") && - attributeMatches(Caller, Callee, "target-features") && + Function *Callee, + TargetTransformInfo &TTI) { + return TTI.hasCompatibleFunctionAttributes(Caller, Callee) && attributeMatches(Caller, Callee, Attribute::SanitizeAddress) && attributeMatches(Caller, Callee, Attribute::SanitizeMemory) && attributeMatches(Caller, Callee, Attribute::SanitizeThread); @@ -1368,7 +1368,8 @@ InlineCost InlineCostAnalysis::getInlineCost(CallSite CS, Function *Callee, // Never inline functions with conflicting attributes (unless callee has // always-inline attribute). - if (!functionsHaveCompatibleAttributes(CS.getCaller(), Callee)) + if (!functionsHaveCompatibleAttributes(CS.getCaller(), Callee, + TTIWP->getTTI(*Callee))) return llvm::InlineCost::getNever(); // Don't inline this call if the caller has the optnone attribute. diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index 24cada3..520d1e5 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -284,6 +284,11 @@ Value *TargetTransformInfo::getOrCreateResultFromMemIntrinsic( return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType); } +bool TargetTransformInfo::hasCompatibleFunctionAttributes( + const Function *Caller, const Function *Callee) const { + return TTIImpl->hasCompatibleFunctionAttributes(Caller, Callee); +} + TargetTransformInfo::Concept::~Concept() {} TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {} |
