Please find attached the new version of this patch addressing all suggestions given. I splat the patch into 2 to ease the review: part3 only split stmt manipulation out of optimize_bswap into replace_bswap while part4 contains all the changes needed to support load in host endianness (as opposed to byteswap). Part 4 is sent in a separate email.
I also have a few comments. > From: Richard Biener [mailto:richard.guent...@gmail.com] > > Yes, the sign matters - I forgot about that. Eventually the load type > should be just chosen from the target type though. Do you mean making a load directly in the right signedness? There still remains The possibility of the load being of a different size than the target type (difference between range and size explained in the comments of struct symbolic_number). > > >> > >> You seem to replace the stmt computing the target value by directly > >> loading into the target. IMHO that's premature optimization and it > >> would be easier to just replace its rhs (that way the stmt still has > >> a proper location for example). I changed to just replace its rhs but you'll notice that the code is bigger and there is a bit of duplication. However, I didn't replace the original code as gimple_build_call creates a statement, not a tree that could replace the rhs. Also replacing the rhs could only be done if no load was done prior as else a statement is already created before. ChangeLog are now as follows: *** gcc/ChangeLog *** 2014-05-04 Thomas Preud'homme <thomas.preudho...@arm.com> PR tree-optimization/54733 * tree-ssa-math-opts.c (execute_optimize_bswap): Move its leading comment back in place. Also split statement transformation into ... (bswap_replace): This. Is it ok for stage1? Best regards, Thomas Preud'homme
gcc32rm-84.5.1.part3.diff
Description: Binary data