Stuff like cast<T>(widening_XXX(a, b)) with both a and b being of type T is an inefficient way to just XXX. This can be generated by doing XXX(a, b) where a is of type T, but b is not of type T yet (such as a user-provided constant).
I propose a pass to emit a warning when this pattern is found. Probably the user has bad code that can be fixed. I'd be in favor of warning for now, instead of optimizing it away I think, as I would want to know about me doing something with the wrong datatypes, and hence I think the operands should be fixed by the user.
Stuff like
cast<T>(widening_XXX(a, b))with bothaandbbeing of typeTis an inefficient way to justXXX. This can be generated by doingXXX(a, b)whereais of typeT, butbis not of typeTyet (such as a user-provided constant).I propose a pass to emit a warning when this pattern is found. Probably the user has bad code that can be fixed. I'd be in favor of warning for now, instead of optimizing it away I think, as I would want to know about me doing something with the wrong datatypes, and hence I think the operands should be fixed by the user.