summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorEvandro Menezes <e.menezes@samsung.com>2019-04-03 21:27:03 +0000
committerEvandro Menezes <e.menezes@samsung.com>2019-04-03 21:27:03 +0000
commit7c711ccf36e0a818f76d711715956ffe831f53b6 (patch)
treecfbd36f2d353a8c2eed5a47196fb39821ac5ec1f /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parent4d50879d9c93cdadfd6b0918931907c821d06520 (diff)
downloadbcm5719-llvm-7c711ccf36e0a818f76d711715956ffe831f53b6.tar.gz
bcm5719-llvm-7c711ccf36e0a818f76d711715956ffe831f53b6.zip
[IR] Create new method in `Function` class (NFC)
Create method `optForNone()` testing for the function level equivalent of `-O0` and refactor appropriately. Differential revision: https://reviews.llvm.org/D59852 llvm-svn: 357638
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 77e98ecd910..d396882cc7e 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1366,8 +1366,7 @@ PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
bool HasUnknownCall = false;
for (LazyCallGraph::Node &N : C) {
Function &F = N.getFunction();
- if (F.hasFnAttribute(Attribute::OptimizeNone) ||
- F.hasFnAttribute(Attribute::Naked)) {
+ if (F.optForNone() || F.hasFnAttribute(Attribute::Naked)) {
// Treat any function we're trying not to optimize as if it were an
// indirect call and omit it from the node set used below.
HasUnknownCall = true;
@@ -1440,8 +1439,7 @@ static bool runImpl(CallGraphSCC &SCC, AARGetterT AARGetter) {
bool ExternalNode = false;
for (CallGraphNode *I : SCC) {
Function *F = I->getFunction();
- if (!F || F->hasFnAttribute(Attribute::OptimizeNone) ||
- F->hasFnAttribute(Attribute::Naked)) {
+ if (!F || F->optForNone() || F->hasFnAttribute(Attribute::Naked)) {
// External node or function we're trying not to optimize - we both avoid
// transform them and avoid leveraging information they provide.
ExternalNode = true;
OpenPOWER on IntegriCloud