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

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 14 17:26:09 PDT 2025


================
@@ -1649,7 +1649,27 @@ 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() {
+
+  std::set<llvm::StringRef> labels;
----------------
andykaylor wrote:

I think `llvm::SmallSet` would be a better choice here. For a discussion of tradeoffs, see https://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc

In this case, it basically comes down to a trade off of linear lookup (in the case of SmallSet) versus malloc-intensive storage (in the case of std::set). If we assume that the number of labels and gotos in the function is going to be relatively small, which I hope is true in most cases, SmallSet is better.

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


More information about the cfe-commits mailing list