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.
Note: This patch will be helpful to keep nice MLIR outputs when I push the patch to do the forwarding of statically known information as part of a folding of extract_strided_metadata.
I acknowledge that this API is complicated, but it is not meant to be used directly.
This represents the meat of what the getConstifiedMixedXXX methods do, thus we have to support size, strides, and offset.