[llvm] 4b05341 - Don't check if the result of hasAttrSomewhere is non-zero in CallBase::getReturnedArgOperand()
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 7 12:06:28 PDT 2021
Author: Arthur Eubanks
Date: 2021-09-07T12:05:56-07:00
New Revision: 4b053416812f56ad661b650762d20ff4c9849f66
URL: https://github.com/llvm/llvm-project/commit/4b053416812f56ad661b650762d20ff4c9849f66
DIFF: https://github.com/llvm/llvm-project/commit/4b053416812f56ad661b650762d20ff4c9849f66.diff
LOG: Don't check if the result of hasAttrSomewhere is non-zero in CallBase::getReturnedArgOperand()
Index is 0 when the return value has the returned attribute. But the
return value cannot have the returned attribute, so the check is
pointless.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D109334
Added:
Modified:
llvm/lib/IR/Instructions.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 16507f5bcdef..43cfdd34e533 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -328,11 +328,10 @@ bool CallBase::isReturnNonNull() const {
Value *CallBase::getReturnedArgOperand() const {
unsigned Index;
- if (Attrs.hasAttrSomewhere(Attribute::Returned, &Index) && Index)
+ if (Attrs.hasAttrSomewhere(Attribute::Returned, &Index))
return getArgOperand(Index - AttributeList::FirstArgIndex);
if (const Function *F = getCalledFunction())
- if (F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
- Index)
+ if (F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index))
return getArgOperand(Index - AttributeList::FirstArgIndex);
return nullptr;
More information about the llvm-commits
mailing list