[Mlir-commits] [mlir] [mlir] Add option to ignore commutativity in OperationEquality (PR #181507)
Mehdi Amini
llvmlistbot at llvm.org
Sun Feb 15 07:48:39 PST 2026
================
@@ -784,11 +785,12 @@ struct ValueEquivalenceCache {
if (lhsIt == lhsRange.end())
return success();
- // Handle another simple case where operands are just a permutation.
- // Note: This is not sufficient, this handles simple cases relatively
- // cheaply.
- auto sortValues = [](ValueRange values) {
- SmallVector<Value> sortedValues = llvm::to_vector(values);
+ // Replace values with their entry in equivalentValues if they're in there.
+ // That way, a sorted pointer comparison is enough to determine
+ // commutativity.
+ auto sortValues = [this](ValueRange values) {
+ SmallVector<Value> sortedValues = llvm::map_to_vector(
+ values, [this](Value a) { return equivalentValues.lookup_or(a, a); });
----------------
joker-eph wrote:
Can you split this in its own PR with its own test?
https://github.com/llvm/llvm-project/pull/181507
More information about the Mlir-commits
mailing list