[clang] [CIR] Split side_effect into memory effects, nounwind, and willreturn (PR #223890)
Adam Smith via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 20 16:26:19 PDT 2026
================
@@ -1309,6 +1308,29 @@ parseTryCallDestinations(mlir::OpAsmParser &parser,
return mlir::success();
}
+/// Reject an effect attribute of the wrong kind in an explicit attribute
+/// dictionary. Where these are declared they are stored as properties, so a
+/// value of the wrong kind would be dropped without a diagnostic.
+static ParseResult checkEffectAttrKinds(mlir::OpAsmParser &parser,
+ llvm::SMLoc loc,
+ const mlir::NamedAttrList &attrs) {
+ if (mlir::Attribute effects =
+ attrs.get(CIRDialect::getMemoryEffectsAttrName()))
+ if (!mlir::isa<cir::MemoryEffectsAttr>(effects))
----------------
adams381 wrote:
ODS doesn't catch it. It's a declared attribute, so it lands in a property and a wrong kind gets `dyn_cast_or_null`'d to null before any verifier runs. `attributes {memory_effects = 42 : i32}` round-trips to nothing, exit 0. Same reason it's in the parser rather than `verify()`, by then the bad value is already gone.
The hole is one I opened, though. Before this, cir.func rejected every declared name from the explicit list and `side_effect` had its own syntax. I can cover all four flags, drop the check, or give memory_effects its own syntax the way `func_info` does. Preference?
https://github.com/llvm/llvm-project/pull/223890
More information about the cfe-commits
mailing list