================
@@ -5818,6 +5818,16 @@ mlir::LogicalResult 
CIRToLLVMTokenNoneOpLowering::matchAndRewrite(
 mlir::LogicalResult CIRToLLVMCpuIdOpLowering::matchAndRewrite(
     cir::CpuIdOp op, OpAdaptor adaptor,
     mlir::ConversionPatternRewriter &rewriter) const {
+  mlir::ModuleOp moduleOp = op->getParentOfType<mlir::ModuleOp>();
+  std::optional<llvm::Triple> triple = cir::getTripleFromModule(moduleOp);
+  if (!triple) {
+    moduleOp.emitError() << "cannot lower " << op.getOperationName() << " "
+                         << "without a '"
+                         << cir::CIRDialect::getTripleAttrName() << "' "
+                         << "attribute";
+    return mlir::failure();
+  }
+
----------------
ianayl wrote:

I changed the wording, but I didn't leave a comment since it'd be caught when 
we drop the std::optional when the triple becomes a mandatory attribute

https://github.com/llvm/llvm-project/pull/230003
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to