[all-commits] [llvm/llvm-project] 210958: [MLIR] Don't sort operand of commutative ops when ...

tomnatan30 via All-commits all-commits at lists.llvm.org
Fri Jul 14 16:12:19 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2109587cee341329c49fa999725ce6a486621b37
      https://github.com/llvm/llvm-project/commit/2109587cee341329c49fa999725ce6a486621b37
  Author: tomnatan <tomnatan at google.com>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    M flang/test/Fir/commute.fir
    M mlir/lib/IR/OperationSupport.cpp
    M mlir/test/Dialect/Func/duplicate-function-elimination.mlir
    M mlir/test/Transforms/cse.mlir

  Log Message:
  -----------
  [MLIR] Don't sort operand of commutative ops when comparing two ops as there is a correctness issue

This feature was introduced in `D123492`.

Doing equivalence on pointers to sort operands of commutative operations is incorrect when checking equivalence of ops in separate regions (where the lhs and rhs operands are marked as equivalent but are not the same value).

It was also discussed in `D123492` and `D129480` that the correct solution would be to stable sort the operands in canonicalization (based on some numbering in the region maybe), but until that lands, reverting this change will unblock us and other users.

An example of a pass that might not work properly because of this is `DuplicateFunctionEliminationPass`.

Reviewed By: mehdi_amini, jpienaar

Differential Revision: https://reviews.llvm.org/D154699




More information about the All-commits mailing list