https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726
--- Comment #12 from kugan at gcc dot gnu.org --- Created attachment 35976 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35976&action=edit patch for tree-ssa-reassoc Here is a prototype patch (to fix comment 9) that makes tree-ssa-reassoc understand after sinking the casts. Not fully tested yet.