[PATCH] D124750: [MLIR] Add a utility to sort the operands of commutative ops

Jeff Niu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 29 10:25:41 PDT 2022


Mogball accepted this revision.
Mogball added a comment.
This revision is now accepted and ready to land.

Got a few small nits but otherwise LGTM. Thanks for all the hard work! This looks really solid now. I haven't thought too hard about the performance of that while loop but it seems good enough to land for now.



================
Comment at: mlir/lib/Transforms/Utils/CommutativityUtils.cpp:246
+    // `constCommOperandA`'s "key" is smaller.
+    auto CommutativeOperandComparator =
+        [](const std::unique_ptr<CommutativeOperand> &constCommOperandA,
----------------



================
Comment at: mlir/lib/Transforms/Utils/CommutativityUtils.cpp:252
+
+          std::unique_ptr<CommutativeOperand> &commOperandA =
+              const_cast<std::unique_ptr<CommutativeOperand> &>(
----------------



================
Comment at: mlir/lib/Transforms/Utils/CommutativityUtils.cpp:255
+                  constCommOperandA);
+          std::unique_ptr<CommutativeOperand> &commOperandB =
+              const_cast<std::unique_ptr<CommutativeOperand> &>(
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124750/new/

https://reviews.llvm.org/D124750



More information about the cfe-commits mailing list