[Mlir-commits] [mlir] [mlir][llvm] Add llvm.target_features features attribute (PR #71510)

Cullen Rhodes llvmlistbot at llvm.org
Thu Nov 30 06:52:16 PST 2023


================
@@ -1694,6 +1695,11 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func,
         context, IntegerAttr::get(intTy, attr.getVScaleRangeMin()),
         IntegerAttr::get(intTy, attr.getVScaleRangeMax().value_or(0))));
   }
+  if (llvm::Attribute attr = func->getFnAttribute("target-features");
+      attr.isStringAttribute()) {
+    funcOp.setTargetFeaturesAttr(
+        LLVM::TargetFeaturesAttr::get(context, attr.getValueAsString()));
----------------
c-rhodes wrote:

nit: personally would find it clearer if `attr.isStringAttribute()` was in a separate if, threw me off a little.
```suggestion
  if (llvm::Attribute attr = func->getFnAttribute("target-features")) {
    if (attr.isStringAttribute())
      funcOp.setTargetFeaturesAttr(
          LLVM::TargetFeaturesAttr::get(context, attr.getValueAsString()));
  }
```

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


More information about the Mlir-commits mailing list