summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2016-07-11 04:51:23 +0000
committerHal Finkel <hfinkel@anl.gov>2016-07-11 04:51:23 +0000
commit02012bcfee8f2a7c37dc38b35efbeb8c91c9cf28 (patch)
treec4769c5547053836b6f56cc56171e1f12944ad30 /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parente64985fc94993fc748b9afe84943dec659bdab29 (diff)
downloadbcm5719-llvm-02012bcfee8f2a7c37dc38b35efbeb8c91c9cf28.tar.gz
bcm5719-llvm-02012bcfee8f2a7c37dc38b35efbeb8c91c9cf28.zip
Revert r275027 - Let FuncAttrs infer the 'returned' argument attribute
Reverting r275027 and r275033. These seem to cause miscompiles on the AArch64 buildbot. llvm-svn: 275042
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 9c9e4822199..fff54408541 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -42,7 +42,6 @@ using namespace llvm;
STATISTIC(NumReadNone, "Number of functions marked readnone");
STATISTIC(NumReadOnly, "Number of functions marked readonly");
STATISTIC(NumNoCapture, "Number of arguments marked nocapture");
-STATISTIC(NumReturned, "Number of arguments marked returned");
STATISTIC(NumReadNoneArg, "Number of arguments marked readnone");
STATISTIC(NumReadOnlyArg, "Number of arguments marked readonly");
STATISTIC(NumNoAlias, "Number of function returns marked noalias");
@@ -484,53 +483,6 @@ determinePointerReadAttrs(Argument *A,
return IsRead ? Attribute::ReadOnly : Attribute::ReadNone;
}
-/// Deduce returned attributes for the SCC.
-static bool addArgumentReturnedAttrs(const SCCNodeSet &SCCNodes) {
- bool Changed = false;
-
- AttrBuilder B;
- B.addAttribute(Attribute::Returned);
-
- // Check each function in turn, determining if an argument is always returned.
- for (Function *F : SCCNodes) {
- // We can infer and propagate function attributes only when we know that the
- // definition we'll get at link time is *exactly* the definition we see now.
- // For more details, see GlobalValue::mayBeDerefined.
- if (!F->hasExactDefinition())
- continue;
-
- if (F->getReturnType()->isVoidTy())
- continue;
-
- auto FindRetArg = [&]() -> Value * {
- Value *RetArg = nullptr;
- for (BasicBlock &BB : *F)
- if (auto *Ret = dyn_cast<ReturnInst>(BB.getTerminator())) {
- // Note that stripPointerCasts should look through functions with
- // returned arguments.
- Value *RetVal = Ret->getReturnValue()->stripPointerCasts();
- if (RetVal->getType() == F->getReturnType() && isa<Argument>(RetVal)) {
- if (!RetArg)
- RetArg = RetVal;
- else if (RetArg != RetVal)
- return nullptr;
- }
- }
-
- return RetArg;
- };
-
- if (Value *RetArg = FindRetArg()) {
- auto *A = cast<Argument>(RetArg);
- A->addAttr(AttributeSet::get(F->getContext(), A->getArgNo() + 1, B));
- ++NumReturned;
- Changed = true;
- }
- }
-
- return Changed;
-}
-
/// Deduce nocapture attributes for the SCC.
static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
bool Changed = false;
@@ -1072,7 +1024,6 @@ PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
}
bool Changed = false;
- Changed |= addArgumentReturnedAttrs(SCCNodes);
Changed |= addReadAttrs(SCCNodes, AARGetter);
Changed |= addArgumentAttrs(SCCNodes);
@@ -1138,7 +1089,6 @@ static bool runImpl(CallGraphSCC &SCC, AARGetterT AARGetter) {
SCCNodes.insert(F);
}
- Changed |= addArgumentReturnedAttrs(SCCNodes);
Changed |= addReadAttrs(SCCNodes, AARGetter);
Changed |= addArgumentAttrs(SCCNodes);
OpenPOWER on IntegriCloud