On Tue, Jul 08, 2025 at 08:15:30AM +0200, Richard Biener wrote: > > No. Because (most of the) pointer conversions are useless, if you have > > _2 = &something.fam[0]; > > ... > > _4 = &something.fam; > > _5 = .ACCESS_WITH_SIZE (_4, ...); > > (or whatever else where _4 has the carefully chosen pointer type for the > > behavior of the IFN), if e.g. SCCVN finds out that _2 and _4 must have the > > same value, regardless of different type, if useless_type_conversion_p > > (TREE_TYPE (_4), TREE_TYPE (_2)), it will happily replace _4 with _2, and > > all of sudden you have a different type. > > You could look at the type of the LHS though, unless there are two „same“ > AWS with only different return type and we are able to CSE them.
True. But I'm arguing that instead of the first argument's type/return type pointee we want to know its original TYPE_SIZE_UNIT (so value by which what the second argument points to should be multiplied) and a pointer type which can be used in the dereference of the second argument. That is I think 4 arguments, REF_TO_OBJ (ptr), REF_TO_SIZE (ptr), ELTSZ (sizetype), flags (INTEGER_CST, type original type of REG_TO_SIZE, bitfield of the various flags). Jakub