[Mlir-commits] [mlir] 19a62fb - [OpenMP][MLIR] Fix llvm::sort comparator. (#91947)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon May 13 05:08:28 PDT 2024


Author: Oleg Shyshkov
Date: 2024-05-13T14:08:25+02:00
New Revision: 19a62fbe00930d7eaa9f948c8dd26d58f5422c00

URL: https://github.com/llvm/llvm-project/commit/19a62fbe00930d7eaa9f948c8dd26d58f5422c00
DIFF: https://github.com/llvm/llvm-project/commit/19a62fbe00930d7eaa9f948c8dd26d58f5422c00.diff

LOG: [OpenMP][MLIR] Fix llvm::sort comparator. (#91947)

llvm::sort requires the comparator to return `false` for equal elements,
otherwise it triggers `Your comparator is not a valid strict-weak
ordering` assert.

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 0c34126667324..282e640d3aaad 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -2175,10 +2175,10 @@ getFirstOrLastMappedMemberPtr(mlir::omp::MapInfoOp mapInfo, bool first) {
             return !first;
         }
 
-        // iterated the entire list and couldn't make a decision, all elements
-        // were likely the same, return true for now similar to reaching the end
-        // of both and finding invalid indices.
-        return true;
+        // Iterated the entire list and couldn't make a decision, all elements
+        // were likely the same. Return false, since the sort comparator should
+        // return false for equal elements.
+        return false;
       });
 
     return llvm::cast<mlir::omp::MapInfoOp>(


        


More information about the Mlir-commits mailing list