[mlir][MemRef] Make reinterpret_cast(extract_strided_metadata) more robust
Prior to this patch the canonicalization pattern that turns `reinterpret_cast(extract_strided_metadata)` into cast was only applied when all the input operands of the `reinterpret_cast` are exactly all the output results of the `extract_strided_metadata`. This missed simplification opportunities when the values would have hold the same constant values, but yet, come from different actual values. E.g., prior to this patch, a pattern of the form: ``` %base, %offset = extract_strided_metadata %source : memref<i16> reinterpret_cast %base to offset:[0] ``` Wouldn't have been simplified into a simple cast, because %offset is not directly the same value object as 0. This patch teaches this pattern how to check if the constant values match what the results of the `extract_strided_metadata` operation would have hold. Differential Revision: https://reviews.llvm.org/D135736
Loading
Please sign in to comment