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

Tobias Gysi llvmlistbot at llvm.org
Thu Sep 21 07:12:54 PDT 2023


================
@@ -1610,6 +1612,16 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func,
     funcOp.setArmStreaming(true);
   else if (func->hasFnAttribute("aarch64_pstate_sm_body"))
     funcOp.setArmLocallyStreaming(true);
+  llvm::Attribute attr = func->getFnAttribute(llvm::Attribute::VScaleRange);
+  if (attr.isValid()) {
+    MLIRContext *context = funcOp.getContext();
+    auto intTy = mlir::IntegerType::get(context, 32);
+    std::optional<unsigned> maxAttr = attr.getVScaleRangeMax();
+    unsigned maxVal = maxAttr ? *maxAttr : 0;
----------------
gysit wrote:

You should be able to replace this line by `maxAttr.value_or(0)`

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


More information about the Mlir-commits mailing list