summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-09-12 16:04:59 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-09-12 16:04:59 +0000
commitc83044d9bb6a1fc7b0962f499c03144c6858a7bc (patch)
treec0ae7de20a16f5fcc21828cd56e95457efef1296 /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parent0531f0a5bbd581bcb794bfa05b80c57a4aec68cc (diff)
downloadbcm5719-llvm-c83044d9bb6a1fc7b0962f499c03144c6858a7bc.tar.gz
bcm5719-llvm-c83044d9bb6a1fc7b0962f499c03144c6858a7bc.zip
[FunctionAttrs] Don't try to infer returned if it is already on an argument
Trying to infer the 'returned' attribute if an argument is already 'returned' can lead to verification failure: inference might determine that a different argument is passed through which would result in two different arguments marked as 'returned'. This fixes PR30350. llvm-svn: 281221
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 96dcf9de7d5..0fde10752b5 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -496,6 +496,11 @@ static bool addArgumentReturnedAttrs(const SCCNodeSet &SCCNodes) {
if (F->getReturnType()->isVoidTy())
continue;
+ // There is nothing to do if an argument is already marked as 'returned'.
+ if (any_of(F->args(),
+ [](const Argument &Arg) { return Arg.hasReturnedAttr(); }))
+ continue;
+
auto FindRetArg = [&]() -> Value * {
Value *RetArg = nullptr;
for (BasicBlock &BB : *F)
OpenPOWER on IntegriCloud