aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorgoldsteinn <35538541+goldsteinn@users.noreply.github.com>2024-10-17 11:32:55 -0400
committerGitHub <noreply@github.com>2024-10-17 10:32:55 -0500
commitc85611e8583e6392d56075ebdfa60893b6284813 (patch)
tree0e9755aaff4332c655e985d957f821faca52661f /llvm/lib/IR/Function.cpp
parentab208de34efbde4fea03732eaa353a701e72f626 (diff)
downloadllvm-c85611e8583e6392d56075ebdfa60893b6284813.zip
llvm-c85611e8583e6392d56075ebdfa60893b6284813.tar.gz
llvm-c85611e8583e6392d56075ebdfa60893b6284813.tar.bz2
[SimplifyLibCall][Attribute] Fix bug where we may keep `range` attr with incompatible type (#112649)
In a variety of places we change the bitwidth of a parameter but don't update the attributes. The issue in this case is from the `range` attribute when inlining `__memset_chk`. `optimizeMemSetChk` will replace an `i32` with an `i8`, and if the `i32` had a `range` attr assosiated it will cause an error. Fixes #112633
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 09b9071..8892959 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -359,6 +359,10 @@ Attribute Argument::getAttribute(Attribute::AttrKind Kind) const {
return getParent()->getParamAttribute(getArgNo(), Kind);
}
+AttributeSet Argument::getAttributes() const {
+ return getParent()->getAttributes().getParamAttrs(getArgNo());
+}
+
//===----------------------------------------------------------------------===//
// Helper Methods in Function
//===----------------------------------------------------------------------===//