TypeConversion: do not materialize conversion of the type to itself
authorAlex Zinenko <zinenko@google.com>
Mon, 1 Jul 2019 16:52:53 +0000 (09:52 -0700)
committerjpienaar <jpienaar@google.com>
Mon, 1 Jul 2019 16:56:56 +0000 (09:56 -0700)
commit5eef726bc8cf1e4b9d1067e52f9ad9f43bc1dec1
tree3cff678cf241e77a56d325379eaed4678afd8283
parenta83fd0d2c7c28dc8d3c3a7f45869782de3d1fb64
TypeConversion: do not materialize conversion of the type to itself

Type conversion does not necessarily affect all types, some of them may remain
untouched.  The type conversion tool from the dialect conversion framework will
unconditionally insert a temporary cast operation from the type to itself
anyway, and will try to materialize it to a real conversion operation if there
are remaining uses.  Simply use the original value instead.

PiperOrigin-RevId: 255975450
mlir/lib/Transforms/DialectConversion.cpp
mlir/test/Transforms/test-legalizer.mlir