[Mlir-commits] [mlir] 1fbccfd - [mlir][IRNumbering] Fix the dialect comparator to be strict

River Riddle llvmlistbot at llvm.org
Tue Feb 7 18:09:09 PST 2023


Author: River Riddle
Date: 2023-02-07T18:06:34-08:00
New Revision: 1fbccfd69324f08f067ca5534abc67d32cad75ed

URL: https://github.com/llvm/llvm-project/commit/1fbccfd69324f08f067ca5534abc67d32cad75ed
DIFF: https://github.com/llvm/llvm-project/commit/1fbccfd69324f08f067ca5534abc67d32cad75ed.diff

LOG: [mlir][IRNumbering] Fix the dialect comparator to be strict

Check if rhs is the dialect to be ordered first, ensuring that
we don't inadvertantly order something before it by
falling back to pure number comparison.

This only shows up depending on the implementation of
stable_sort. This was hit in a build of MSVC that was
checking for strict ordering.

Added: 
    

Modified: 
    mlir/lib/Bytecode/Writer/IRNumbering.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bytecode/Writer/IRNumbering.cpp b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
index cf9be57912f68..1ae9c92c09c4b 100644
--- a/mlir/lib/Bytecode/Writer/IRNumbering.cpp
+++ b/mlir/lib/Bytecode/Writer/IRNumbering.cpp
@@ -63,6 +63,8 @@ static void groupByDialectPerByte(T range) {
                           const auto &rhs) {
     if (lhs->dialect->number == dialectToOrderFirst)
       return rhs->dialect->number != dialectToOrderFirst;
+    if (rhs->dialect->number == dialectToOrderFirst)
+      return false;
     return lhs->dialect->number < rhs->dialect->number;
   };
 


        


More information about the Mlir-commits mailing list