Skip to content

Commit 24b55b9

Browse files
committed
[OpenMP][MLIR] Fix llvm::sort comparator.
llvm::sort requres the comparator to return `false` for equal elements, otherwise it triggers `Your comparator is not a valid strict-weak ordering` assert.
1 parent efe91cf commit 24b55b9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,10 +2175,10 @@ getFirstOrLastMappedMemberPtr(mlir::omp::MapInfoOp mapInfo, bool first) {
21752175
return !first;
21762176
}
21772177

2178-
// iterated the entire list and couldn't make a decision, all elements
2179-
// were likely the same, return true for now similar to reaching the end
2180-
// of both and finding invalid indices.
2181-
return true;
2178+
// Iterated the entire list and couldn't make a decision, all elements
2179+
// were likely the same. Return false, since the sort comparator should
2180+
// return false for equal elements.
2181+
return false;
21822182
});
21832183

21842184
return llvm::cast<mlir::omp::MapInfoOp>(

0 commit comments

Comments
 (0)