[GreedyPatternRewriter] Avoid reversing constant order
authorrkayaith <rkayaith@gmail.com>
Wed, 18 May 2022 07:38:42 +0000 (00:38 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Wed, 18 May 2022 07:55:59 +0000 (00:55 -0700)
commit7814b559bd5e1dbb3c016b393068698bc5781cc5
treee7a6392ccc44e838543f74463e644a98844ae12c
parente9a1c82d695472820c93af40cbf3d9fde2a149c6
[GreedyPatternRewriter] Avoid reversing constant order

The previous fix from af371f9f98da only applied when using a bottom-up
traversal. The change here applies the constant preprocessing logic to the
top-down case as well. This resolves the issue with the canonicalizer pass still
reordering constants, since it uses a top-down traversal by default.

Fixes #51892

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D125623
flang/test/Lower/Intrinsics/achar.f90
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
mlir/test/Dialect/Arithmetic/canonicalize.mlir
mlir/test/Dialect/SCF/canonicalize.mlir
mlir/test/Transforms/test-operation-folder.mlir
mlir/test/lib/Dialect/Test/TestPatterns.cpp