https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69211
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I guess the bug is that lots of code in fold-const.c is totally unprepared to see NOP_EXPR wrapping up INTEGER_CST (or other constants), it assumes that if argN is say INTEGER_CST, then argN == opN and thus does not fold. Rather than changing everything in fold-const.c, I think it is better to make sure cp_fold folds those away early enough. Let me test a patch.