[Mlir-commits] [llvm] [mlir] Number MLIR blocks; require GraphHasNodeNumbers in llvm::LoopInfoBase (PR #207617)

Fangrui Song llvmlistbot at llvm.org
Mon Jul 6 09:55:24 PDT 2026


================
@@ -524,10 +524,13 @@ raw_ostream &operator<<(raw_ostream &OS, const LoopBase<BlockT, LoopT> &Loop) {
 ///
 
 template <class BlockT, class LoopT> class LoopInfoBase {
-  // BBMap - Mapping of basic blocks to the inner most loop they occur in
-  std::conditional_t<GraphHasNodeNumbers<const BlockT *>, SmallVector<LoopT *>,
-                     DenseMap<const BlockT *, LoopT *>>
-      BBMap;
+  static_assert(GraphHasNodeNumbers<const BlockT *>,
+                "LoopInfo requires GraphTraits<BlockT *>::getNumber (see "
+                "GraphHasNodeNumbers)");
----------------
MaskRay wrote:

I was wrong that MLIR was the only in-tree user. 
`bolt/include/bolt/Core/BinaryLoop.h` has a use case as well... Will split.

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


More information about the Mlir-commits mailing list