Andrew Pinski wrote: > Yury Gribov wrote: >> Andrew Pinski wrote: >>> Yury Gribov wrote: >>>> I've recently noticed that GCC generates suboptimal code >>>> for Asan on ARM targets. E.g. for a 4-byte memory access check >>> >>> Does the patch series at located at: >>> http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01407.html >>> http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01405.html >>> Fix this code generation issue? I suspect it does and improves more >>> than just the above code. >> >> No, they don't help as is. > > I think it would good to figure out how to improve this code gen > with the above patches rather than changing asan. > I suspect it might easy to expand them to handle this case too.
I was indeed able to reuse Zhenqiang's work. After updating select_ccmp_cmp_order hook to also return suggestions on how to change comparisons to allow better code generation (so it sounds more like select_ccmp_cmp_layout now) I was able to use this information in expand_ccmp_expr to generate optimal code.
The patch is still a draft (only supports Asan's case) and I think I'll wait until Zhenqiang's conditional compare patches get into trunk before going deeper (not sure when this is going to happen though...).
-Y