[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:27 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))
+      return parser.emitError(loc, "attribute '")
+             << CIRDialect::getMemoryEffectsAttrName()
+             << "' must be a #cir.memory_effects attribute";
+
+  for (llvm::StringRef name :
+       {CIRDialect::getNoUnwindAttrName(), CIRDialect::getWillReturnAttrName()})
+    if (mlir::Attribute flag = attrs.get(name))
----------------
adams381 wrote:

See the reply above.

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


More information about the cfe-commits mailing list