http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59999
--- Comment #7 from Paulo J. Matos <pa...@matos-sorge.com> --- (In reply to Richard Biener from comment #5) > Apart from expand there is the redundant-extension-elimination, ree.c. In expand we get the following gimple for the loop: ;; basic block 4, loop depth 0 ;; pred: 2 ;; 4 # i_15 = PHI <0(2), i_12(4)> # _18 = PHI <0(2), _4(4)> _6 = arr[_18]; _7 = _6 + 1; arr[_18] = _7; _17 = (unsigned short) i_15; _13 = _17 + 1; i_12 = (short int) _13; _4 = (int) i_12; if (_4 < limit_5(D)) goto <bb 4>; else goto <bb 3>; ;; succ: 4 ;; 3 Where _13 is an unsigned short and what we want to eliminate is this sign extend: _4 = (int) i_12; This doesn't seem trivial in the expand phase because to eliminate the sign expand, you promote i_12 to int and have then to promote a bunch of other variables, whose insn have been already emitted when you get here. Shouldn't this be ivopts noticing that if it generates an int IV, it saves a sign extend and therefore is better?