[llvm] [LangRef] Require that vscale be a power of two (PR #145098)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 13:09:20 PDT 2025


================
@@ -2474,11 +2474,9 @@ bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
   if (!I)
     return false;
 
-  if (Q.CxtI && match(V, m_VScale())) {
-    const Function *F = Q.CxtI->getFunction();
-    // The vscale_range indicates vscale is a power-of-two.
-    return F->hasFnAttribute(Attribute::VScaleRange);
-  }
+  // vscale is a power-of-two by definition
----------------
preames wrote:

Just to highlight - with this change, we no longer need a context instruction with which to find the function.  This is important both because having two different functions in the same module with differently power-of-two vscales is more than bit weird, and because many (most?) callers of this API do not pass a context.  As such, the version without the context is significantly more powerful in practice.  

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


More information about the llvm-commits mailing list