http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47061
--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2010-12-24 15:54:35 UTC --- Created attachment 22851 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22851 another testcase This testcase seems to be optimised at the RTL level. $ gcc pr47061-2.c -S -O3 -fdump-tree-vrp .vrp1/2 dumps show: ... c_1(D): VARYING D.2684_2: [-128, 127] i_3: VARYING D.2685_4: [0, 1] ... <bb 2>: D.2684_2 = (int) c_1(D); i_3 = D.2684_2 << 1; D.2685_4 = i_3 > 1000; return D.2685_4; ... So the value is known before the shift as well. For the right shift, the function is optimised correctly.