On Tue, Jun 28, 2011 at 12:47 PM, Andrew Stubbs <andrew.stu...@gmail.com> wrote: > On 24/06/11 16:47, Richard Guenther wrote: >>> >>> I can certainly add checks to make sure that the skipped operations >>> > actually don't make any important changes to the value, but do I need >>> > to? >> >> Yes. > > OK, how about this patch?
I'd name the predicate value_preserving_conversion_p which I think is what you mean. harmless isn't really descriptive. Note that you include non-value-preserving conversions, namely int -> unsigned int. Don't dispatch to useless_type_conversion_p, it's easy to enumerate which conversions are value-preserving. Don't try to match the tree_ssa_useless_* set of functions, instead put the value_preserving_conversion_p predicate in tree.[ch] and a suitable function using it in tree-ssa-math-opts.c. Thanks, Richard. > I've added checks to make sure the value is not truncated at any point. > > I've also changed the test cases to address Janis' comments. > > Andrew >