https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80574
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- With -fdump-tree-original, the signed case looks perfect: return MAX_EXPR <MAX_EXPR <MAX_EXPR <MAX_EXPR <MAX_EXPR <a3, a2>, a1>, a3>, a2>, a1>; (which reassoc eventually simplifies) while in the unsigned case, we fail to recognize the innermost max: return (unsigned char) MAX_EXPR <MAX_EXPR <MAX_EXPR <MAX_EXPR <a2 > a3 ? (int) a2 : (int) a3, (int) a1>, (int) a3>, (int) a2>, (int) a1>; and we also fail during gimple, probably because of the conversions.