[mlir][Pass] Allow duplicate pass registration.
authorRiver Riddle <riddleriver@gmail.com>
Fri, 10 Apr 2020 21:49:44 +0000 (14:49 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Fri, 10 Apr 2020 21:49:59 +0000 (14:49 -0700)
Summary: With users registering their own dependencies, duplicate pass registration becomes more and more common. This revision relaxes that pass registration be unique. This is safe to assume given that we key on the passID, which is guaranteed to be unique per pass class.

Differential Revision: https://reviews.llvm.org/D77909

mlir/lib/Pass/PassRegistry.cpp

index 74ac36a..69962ec 100644 (file)
@@ -100,9 +100,7 @@ void mlir::registerPass(StringRef arg, StringRef description,
   // TODO: We should use the 'arg' as the lookup key instead of the pass id.
   const PassID *passID = function()->getPassID();
   PassInfo passInfo(arg, description, passID, function);
-  bool inserted = passRegistry->try_emplace(passID, passInfo).second;
-  assert(inserted && "Pass registered multiple times");
-  (void)inserted;
+  passRegistry->try_emplace(passID, passInfo);
 }
 
 /// Returns the pass info for the specified pass class or null if unknown.