[clang] [CIR] Upstream GotoOp (PR #153701)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 14:52:33 PDT 2025


================
@@ -1649,7 +1651,26 @@ void cir::FuncOp::print(OpAsmPrinter &p) {
 
 // TODO(CIR): The properties of functions that require verification haven't
 // been implemented yet.
-mlir::LogicalResult cir::FuncOp::verify() { return success(); }
+mlir::LogicalResult cir::FuncOp::verify() {
+
+  llvm::SmallSet<llvm::StringRef, 16> labels;
+  llvm::SmallSet<llvm::StringRef, 16> gotos;
+
+  getOperation()->walk([&](mlir::Operation *op) {
+    if (auto lab = dyn_cast<cir::LabelOp>(op)) {
+      labels.insert(lab.getLabel());
+    } else if (auto goTo = dyn_cast<cir::GotoOp>(op)) {
+      gotos.insert(goTo.getLabel());
+    }
+  });
+
+  llvm::SmallSet<llvm::StringRef, 16> mismatched =
----------------
bcardosolopes wrote:

Please surround all the logic from here til prior to return success only if either set is not empty. 

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


More information about the cfe-commits mailing list