diff options
author | goldsteinn <35538541+goldsteinn@users.noreply.github.com> | 2024-10-17 21:28:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 20:28:47 -0500 |
commit | 69a798a996e0cd9d521db38167cadf841d629d38 (patch) | |
tree | 7cad9a07fb45ee354c861c8ad01aaba5eb938ae1 /llvm/lib/IR/Attributes.cpp | |
parent | e9eec14bb3566f6578950797559de98678f16985 (diff) | |
download | llvm-69a798a996e0cd9d521db38167cadf841d629d38.zip llvm-69a798a996e0cd9d521db38167cadf841d629d38.tar.gz llvm-69a798a996e0cd9d521db38167cadf841d629d38.tar.bz2 |
Reapply "[Inliner] Propagate more attributes to params when inlining (#91101)" (2nd Attempt) (#112749)
Root cause of the bug was code hanging onto `range` attr after
changing BitWidth. This was fixed in PR #112633.
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 223c917..e9daa01b 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1931,6 +1931,14 @@ AttributeList::getParamDereferenceableOrNullBytes(unsigned Index) const { return getParamAttrs(Index).getDereferenceableOrNullBytes(); } +std::optional<ConstantRange> +AttributeList::getParamRange(unsigned ArgNo) const { + auto RangeAttr = getParamAttrs(ArgNo).getAttribute(Attribute::Range); + if (RangeAttr.isValid()) + return RangeAttr.getRange(); + return std::nullopt; +} + FPClassTest AttributeList::getRetNoFPClass() const { return getRetAttrs().getNoFPClass(); } @@ -2277,6 +2285,13 @@ Attribute AttrBuilder::getAttribute(StringRef A) const { return {}; } +std::optional<ConstantRange> AttrBuilder::getRange() const { + const Attribute RangeAttr = getAttribute(Attribute::Range); + if (RangeAttr.isValid()) + return RangeAttr.getRange(); + return std::nullopt; +} + bool AttrBuilder::contains(Attribute::AttrKind A) const { return getAttribute(A).isValid(); } |