Make identity cast operations with the same operand and result types legal
authorSmit Hinsu <hinsu@google.com>
Sun, 28 Apr 2019 03:55:38 +0000 (20:55 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 6 May 2019 15:19:37 +0000 (08:19 -0700)
commitc9b0540b9c488b79b7c89f6abe80a3285817fb29
treed1bc7f7ac88e9972187948c5315c954b0b32e21b
parent1316db3baa13f0d84350b9c57a752f728959ad24
Make identity cast operations with the same operand and result types legal

    Instead, fold such operations. This way callers don't need to conditionally create cast operations depending on if a value already has the target type.

    Also, introduce areCastCompatible to allow cast users to verify that the generated op will be valid before creating the operation.

    TESTED with unit tests

--

PiperOrigin-RevId: 245606133
mlir/g3doc/LangRef.md
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/StandardOps/Ops.h
mlir/lib/IR/Operation.cpp
mlir/lib/StandardOps/Ops.cpp
mlir/test/Transforms/canonicalize.mlir