aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorDylan Fleming <Dylan.Fleming@arm.com>2021-08-17 14:00:47 +0100
committerDylan Fleming <Dylan.Fleming@arm.com>2021-08-17 14:42:47 +0100
commitef198cd99e6bac3a2e87adb6c8a18fb461056fa6 (patch)
treed7fda068350afe94214bba5d16f62194c3cb2f4e /clang/lib/CodeGen/CodeGenFunction.cpp
parent9de882fdbf7436c9ddd9b35b335ec91a524353a5 (diff)
downloadllvm-ef198cd99e6bac3a2e87adb6c8a18fb461056fa6.zip
llvm-ef198cd99e6bac3a2e87adb6c8a18fb461056fa6.tar.gz
llvm-ef198cd99e6bac3a2e87adb6c8a18fb461056fa6.tar.bz2
[SVE] Remove usage of getMaxVScale for AArch64, in favour of IR Attribute
Removed AArch64 usage of the getMaxVScale interface, replacing it with the vscale_range(min, max) IR Attribute. Reviewed By: paulwalker-arm Differential Revision: https://reviews.llvm.org/D106277
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index f5eed85..dca4204 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -484,11 +484,13 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
// function.
CurFn->addFnAttr("min-legal-vector-width", llvm::utostr(LargestVectorWidth));
- // Add vscale attribute if appropriate.
- if (getLangOpts().ArmSveVectorBits) {
- unsigned VScale = getLangOpts().ArmSveVectorBits / 128;
- CurFn->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(getLLVMContext(),
- VScale, VScale));
+ // Add vscale_range attribute if appropriate.
+ Optional<std::pair<unsigned, unsigned>> VScaleRange =
+ getContext().getTargetInfo().getVScaleRange(getLangOpts());
+ if (VScaleRange) {
+ CurFn->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(
+ getLLVMContext(), VScaleRange.getValue().first,
+ VScaleRange.getValue().second));
}
// If we generated an unreachable return block, delete it now.