aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2023-08-01 16:59:53 -0500
committerNoah Goldstein <goldstein.w.n@gmail.com>2023-08-16 22:43:04 -0500
commit612a7f0b15a2b40d725bcfe618fbc69f1cb15607 (patch)
treeb0c5aa9f7a08bfc733ecf2016532edd3df82c782 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent74c4d1e42251592704c8eed2d46f2118f886240e (diff)
downloadllvm-612a7f0b15a2b40d725bcfe618fbc69f1cb15607.zip
llvm-612a7f0b15a2b40d725bcfe618fbc69f1cb15607.tar.gz
llvm-612a7f0b15a2b40d725bcfe618fbc69f1cb15607.tar.bz2
[Inliner] Add the callsites called function return attributes to set addable attributes
We can do this by just querying attribute in the callsite itself. This is both cleaner code and produces bette results. Differential Revision: https://reviews.llvm.org/D156843
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 29e7ca0..9b4c62a 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1341,21 +1341,17 @@ static bool MayContainThrowingOrExitingCall(Instruction *Begin,
}
static AttrBuilder IdentifyValidAttributes(CallBase &CB) {
-
- AttrBuilder AB(CB.getContext(), CB.getAttributes().getRetAttrs());
- if (!AB.hasAttributes())
- return AB;
AttrBuilder Valid(CB.getContext());
// Only allow these white listed attributes to be propagated back to the
// callee. This is because other attributes may only be valid on the call
// itself, i.e. attributes such as signext and zeroext.
- if (auto DerefBytes = AB.getDereferenceableBytes())
+ if (auto DerefBytes = CB.getRetDereferenceableBytes())
Valid.addDereferenceableAttr(DerefBytes);
- if (auto DerefOrNullBytes = AB.getDereferenceableOrNullBytes())
+ if (auto DerefOrNullBytes = CB.getRetDereferenceableOrNullBytes())
Valid.addDereferenceableOrNullAttr(DerefOrNullBytes);
- if (AB.contains(Attribute::NoAlias))
+ if (CB.hasRetAttr(Attribute::NoAlias))
Valid.addAttribute(Attribute::NoAlias);
- if (AB.contains(Attribute::NonNull))
+ if (CB.hasRetAttr(Attribute::NonNull))
Valid.addAttribute(Attribute::NonNull);
return Valid;
}