aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorAndreas Jonson <andjo403@hotmail.com>2024-04-24 19:45:50 +0200
committerGitHub <noreply@github.com>2024-04-25 01:45:50 +0800
commitb8f3024a315074e0f880542c33cb89681eebc5a3 (patch)
tree3d69a8f0b470cebbd4526320cf03715b27e92c1c /llvm/lib/IR/Attributes.cpp
parentff57f40673f0db2c1a867e5697d5407bc9f39a5e (diff)
downloadllvm-b8f3024a315074e0f880542c33cb89681eebc5a3.zip
llvm-b8f3024a315074e0f880542c33cb89681eebc5a3.tar.gz
llvm-b8f3024a315074e0f880542c33cb89681eebc5a3.tar.bz2
[InstCombine] Swap out range metadata to range attribute for cttz/ctlz/ctpop (#88776)
Since all optimizations that use range metadata now also handle range attribute, this patch replaces writes of range metadata for call instructions to range attributes.
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index b2d9992c..9c48a48 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1530,6 +1530,13 @@ AttributeList::addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned Index,
return addParamAttributes(C, Index, B);
}
+AttributeList AttributeList::addRangeRetAttr(LLVMContext &C,
+ const ConstantRange &CR) const {
+ AttrBuilder B(C);
+ B.addRangeAttr(CR);
+ return addRetAttributes(C, B);
+}
+
AttributeList AttributeList::addAllocSizeParamAttr(
LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
const std::optional<unsigned> &NumElemsArg) {