> > but we do not optimize it. I.e. optimized dump has: > > > > test () > > { > > struct bar * barptr.0_1; > > struct foo * fooptr.1_2; > > int _6; > > > > <bb 2> [local count: 1073741824]: > > barptr.0_1 = barptr; > > barptr.0_1->val2 = 1; > > fooptr.1_2 = fooptr; > > MEM[(struct foo *)fooptr.1_2] = 0; > > _6 = barptr.0_1->val2; > > return _6; > > } > > > > I see no reason why we should not constant propagate the return value. > > Indeed a good example. Make it work and add it to the testsuite ;)
I think Martin Jambor is working on it. One needs -fno-tree-sra to get this optimized :) Othewise we punt on the check that both types in MEM_REF are the same. Honza