[Mlir-commits] [mlir] [mlir][sparse] fix logical error when generating sort_coo. (PR #66690)

Aart Bik llvmlistbot at llvm.org
Mon Sep 18 12:54:33 PDT 2023


================
@@ -563,11 +563,14 @@ static void createChoosePivot(OpBuilder &builder, ModuleOp module,
 //   p = (lo+hi)/2  // pivot index
 //   i = lo
 //   j = hi-1
-//   while (i < j) do {
+//   while (true) do {
 //     while (xs[i] < xs[p]) i ++;
 //     i_eq = (xs[i] == xs[p]);
 //     while (xs[j] > xs[p]) j --;
 //     j_eq = (xs[j] == xs[p]);
+//
+//     if (i >= j) return j + 1;
+//
----------------
aartbik wrote:

the return p after the while can be removed now?

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


More information about the Mlir-commits mailing list