[Mlir-commits] [mlir] Add support for MLIR to llvm vscale attribute (PR #67012)
Mats Petersson
llvmlistbot at llvm.org
Thu Sep 21 09:57:23 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()) {
----------------
Leporacanthicus wrote:
The reason the lines above use the `hasFnAttr` is that they don't actually need the attribute as such (in fact, they are renaming the attribute to a differnet name, and it's a unit attribute. I need to get the min/max values out of the attribute that came from LLVM. And yes, `isValid` returns the correct value (false) when there's no attribute - the returned attribute has a NULL `pImpl` if not present, which makes `isValid` say "not valid" - I manually tested with functions that haven't got any attribute - and of coruse, this particular section of code gets run pretty much any time there's a function in some MLIR file, so plenty of other tests will show that "not having an attribute does cause this to not fire.
If you want me to add a test for "not having this attribute", I'll do so, but there's plenty of other tests that at least show "it doesn't cause a problem".
https://github.com/llvm/llvm-project/pull/67012
More information about the Mlir-commits
mailing list