diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp b/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp index 685f8f7d7a00..c32e09875a12 100644 --- a/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp @@ -15,6 +15,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BuildLibCalls.h" +#include "llvm/Transforms/Utils/Local.h" using namespace llvm; #define DEBUG_TYPE "inferattrs" @@ -25,9 +26,15 @@ static bool inferAllPrototypeAttributes( for (Function &F : M.functions()) // We only infer things using the prototype and the name; we don't need - // definitions. - if (F.isDeclaration() && !F.hasOptNone()) - Changed |= inferLibFuncAttributes(F, GetTLI(F)); + // definitions. This ensures libfuncs are annotated and also allows our + // CGSCC inference to avoid needing to duplicate the inference from other + // attribute logic on all calls to declarations (as declarations aren't + // explicitly visited by CGSCC passes in the new pass manager.) + if (F.isDeclaration() && !F.hasOptNone()) { + if (!F.hasFnAttribute(Attribute::NoBuiltin)) + Changed |= inferLibFuncAttributes(F, GetTLI(F)); + Changed |= inferAttributesFromOthers(F); + } return Changed; } |