[Mlir-commits] [mlir] Add support for MLIR to llvm vscale attribute (PR #67012)

Tobias Gysi llvmlistbot at llvm.org
Fri Sep 22 02:28:07 PDT 2023


================
@@ -907,6 +907,12 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
   else if (func.getArmLocallyStreaming())
     llvmFunc->addFnAttr("aarch64_pstate_sm_body");
 
+  if (auto attr = func.getVscaleRange()) {
+    llvmFunc->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(
+        getLLVMContext(), attr->getMinRange().getInt(),
+        attr->getMaxRange().getInt()));
+  }
----------------
gysit wrote:

```suggestion
  if (auto attr = func.getVscaleRange())
    llvmFunc->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(
        getLLVMContext(), attr->getMinRange().getInt(),
        attr->getMaxRange().getInt()));
```
You can drop braces here since it is a single statement.

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


More information about the Mlir-commits mailing list