aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorPaul Walker <paul.walker@arm.com>2025-06-11 11:02:32 +0100
committerGitHub <noreply@github.com>2025-06-11 11:02:32 +0100
commitea9046699eae04ac5159a1666f19b5b32e5d41c1 (patch)
tree92234623c59e09e43223a26e39af2985f83b4cbe /llvm/lib/IR/Function.cpp
parentc59cc2b690b9e528a82ba214f74a8f7c8abb3cde (diff)
downloadllvm-ea9046699eae04ac5159a1666f19b5b32e5d41c1.zip
llvm-ea9046699eae04ac5159a1666f19b5b32e5d41c1.tar.gz
llvm-ea9046699eae04ac5159a1666f19b5b32e5d41c1.tar.bz2
[LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (#130973)
For function whose vscale_range is limited to a single value we can size scalable vectors. This aids SROA by allowing scalable vector load and store operations to be considered for replacement whereby bitcasts through memory can be replaced by vector insert or extract operations.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 63665d8..493dec7 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -1165,6 +1165,18 @@ bool Function::nullPointerIsDefined() const {
return hasFnAttribute(Attribute::NullPointerIsValid);
}
+unsigned Function::getVScaleValue() const {
+ Attribute Attr = getFnAttribute(Attribute::VScaleRange);
+ if (!Attr.isValid())
+ return 0;
+
+ unsigned VScale = Attr.getVScaleRangeMin();
+ if (VScale && VScale == Attr.getVScaleRangeMax())
+ return VScale;
+
+ return 0;
+}
+
bool llvm::NullPointerIsDefined(const Function *F, unsigned AS) {
if (F && F->nullPointerIsDefined())
return true;