https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106268
--- Comment #2 from vfdff <zhongyunde at huawei dot com> --- it seems different for the C version, see detail https://godbolt.org/z/vc1edYKhf in your above case, the icc also doesn't elide the outer loop.