[mlir][cse] do not replace operands in previously simplified operations
authorAndrew Young <youngar17@gmail.com>
Mon, 29 Mar 2021 02:25:32 +0000 (19:25 -0700)
committerAndrew Young <youngar17@gmail.com>
Wed, 31 Mar 2021 19:20:34 +0000 (12:20 -0700)
commit9c61c76b127d53a5d14033cdb6abb4b3daaa0f67
treecf957c8086b5b59f5e42c281265f5ee760c0a5f7
parent807b019ca292e53cc40cc76c1f0efd8a7b2efe62
[mlir][cse] do not replace operands in previously simplified operations

If an operation has been inserted as a key in to the known values
hashtable, then it can not be modified in a way which changes its hash.
This change avoids modifying the operands of any previously recorded
operation, which prevents their hash from changing.

In an SSACFG region, it is impossible to visit an operation before
visiting its operands, so this is not a problem. This situation can only
happen in regions without strict dominance, such as graph regions.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D99486
mlir/lib/Transforms/CSE.cpp
mlir/test/Transforms/cse.mlir