------- Comment #5 from rguenth at gcc dot gnu dot org 2007-07-13 12:19 ------- Actually, the optimized dump ist still correct:
main () { int D.2011; <bb 2>: spinlock[0] = 0; spinlock[1] = 0; <bb 3>: D.2011 = spinlock[0]; if (D.2011 != 0) goto <bb 3>; else goto <bb 4>; <bb 4>: return; } spinlock[0] is re-loaded in every loop iteration. Likewise the assembly is correct. Only if I remove the volatile qualifier from the declaration of spinlock then FRE removes the redundancy. And this is because while we keep the has_volatile_ops on the stmt after the propagation of the pointer, the first alias pass clears it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32721