memref.collapse_shape has verification logic to make sure
result dim must be static if all the collapsing src dims are static.
Cast folding might add more static information for the src operand
of memref.collapse_shape which might change a valid collapsing
operation to be invalid. Add CollapseShapeOpMemRefCastFolder pattern
to fix this.
Minor changes to convertReassociationIndicesToExprs to use context
instead of builder to avoid extra steps to construct temporary
builders.