Hi, This patch fixes a combiner bug in simplify_set which calls CANNOT_CHANGE_MODE_CLASS with wrong mode params. It occurs when trying to simplify paradoxical subregs of hw regs (whose natural mode is lower than a word).
In fact, changing from (set x:m1 (subreg:m1 (op:m2))) to (set (subreg:m2 x) op2) is valid if REG_CANNOT_CHANGE_MODE_P (x, m1, m2) is false and REG_CANNOT_CHANGE_MODE_P (x, GET_MODE (src), GET_MODE (SUBREG_REG (src)) See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79279 Validated on a private target, bootstraped on x86_64-pc-linux-gnu, but I'm not sure which target is the most relevant for this patch though ... OK to commit? Aurélien
Changelog: 2017-01-27 Aurelien Buhrig <aurelien.buhrig....@gmail.com> * combine.c (simplify_set): Fix call to REG_CANNOT_CHANGE_MODE_CLASS_P Index: gcc/combine.c =================================================================== --- gcc/combine.c (revision 244978) +++ gcc/combine.c (working copy) @@ -6796,8 +6796,8 @@ #ifdef CANNOT_CHANGE_MODE_CLASS && ! (REG_P (dest) && REGNO (dest) < FIRST_PSEUDO_REGISTER && REG_CANNOT_CHANGE_MODE_P (REGNO (dest), - GET_MODE (SUBREG_REG (src)), - GET_MODE (src))) + GET_MODE (src), + GET_MODE (SUBREG_REG (src)))) #endif && (REG_P (dest) || (GET_CODE (dest) == SUBREG