https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726
--- Comment #11 from kugan at gcc dot gnu.org --- Thanks for reporting. This test case is valid for targets that has branch cost greater than 1. One way to handle this is by disabling this for convections involving bool that are part of branch (?) I think the real fix is to make tree-ssa-reassoc handle this? Looking into it.