diff options
author | Manoj Gupta <manojgupta@google.com> | 2018-07-30 19:33:53 +0000 |
---|---|---|
committer | Manoj Gupta <manojgupta@google.com> | 2018-07-30 19:33:53 +0000 |
commit | 9d83ce90434aaa00e1b71393b7060bfce793fd69 (patch) | |
tree | 9745d46fdfe8bc41a8b118c70c7ac7abe947bbe0 /llvm/lib/IR/Attributes.cpp | |
parent | 6907ce2f8f7410b179beb6e2db9c8d16a257ce9f (diff) | |
download | bcm5719-llvm-9d83ce90434aaa00e1b71393b7060bfce793fd69.tar.gz bcm5719-llvm-9d83ce90434aaa00e1b71393b7060bfce793fd69.zip |
[Inline] Copy "null-pointer-is-valid" attribute in caller.
Summary:
Normally, inling does not happen if caller does not have
"null-pointer-is-valid"="true" attibute but callee has it.
However, alwaysinline may force callee to be inlined.
In this case, if the caller has the "null-pointer-is-valid"="true"
attribute, copy the attribute to caller.
Reviewers: efriedma, a.elovikov, lebedev.ri, jyknight
Reviewed By: efriedma
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D50000
llvm-svn: 338292
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 9e5f55d4975..d87187481be 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1709,6 +1709,15 @@ adjustMinLegalVectorWidth(Function &Caller, const Function &Callee) { } } +/// If the inlined function has "null-pointer-is-valid=true" attribute, +/// set this attribute in the caller post inlining. +static void +adjustNullPointerValidAttr(Function &Caller, const Function &Callee) { + if (Callee.nullPointerIsDefined() && !Caller.nullPointerIsDefined()) { + Caller.addFnAttr(Callee.getFnAttribute("null-pointer-is-valid")); + } +} + #define GET_ATTR_COMPAT_FUNC #include "AttributesCompatFunc.inc" |