[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

Ricardo Jesus via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 28 11:03:48 PDT 2025


================
@@ -1168,6 +1168,15 @@ 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.getVScaleRangeMax().value_or(0);
+  return VScale == Attr.getVScaleRangeMin() ? VScale : 0;
----------------
rj-jesus wrote:

Nit: maybe you could do `getVScaleRangeMin()` first to avoid the `.value_or(0)` (since the former isn't `std::optional`)?

https://github.com/llvm/llvm-project/pull/130973


More information about the cfe-commits mailing list