summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2017-09-09 18:23:11 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2017-09-09 18:23:11 +0000
commit404f106d71178d3a9f27167e6a060ad577b5fadb (patch)
treec77b721b647825ed1de4f0df7f6a51434482fcb4 /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parent97a56866a2510f8ae3ecfde7b9d9faf444299897 (diff)
downloadbcm5719-llvm-404f106d71178d3a9f27167e6a060ad577b5fadb.tar.gz
bcm5719-llvm-404f106d71178d3a9f27167e6a060ad577b5fadb.zip
Merge isKnownNonNull into isKnownNonZero
It now knows the tricks of both functions. Also, fix a bug that considered allocas of non-zero address space to be always non null Differential Revision: https://reviews.llvm.org/D37628 llvm-svn: 312869
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 813a4b6e283..92810c7d6cb 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -884,11 +884,13 @@ static bool isReturnNonNull(Function *F, const SCCNodeSet &SCCNodes,
if (auto *Ret = dyn_cast<ReturnInst>(BB.getTerminator()))
FlowsToReturn.insert(Ret->getReturnValue());
+ auto &DL = F->getParent()->getDataLayout();
+
for (unsigned i = 0; i != FlowsToReturn.size(); ++i) {
Value *RetVal = FlowsToReturn[i];
// If this value is locally known to be non-null, we're good
- if (isKnownNonNull(RetVal))
+ if (isKnownNonZero(RetVal, DL))
continue;
// Otherwise, we need to look upwards since we can't make any local
OpenPOWER on IntegriCloud