https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110248
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- I think the main issue is that IVOPTs treats all of the memory access internal functions as calls and thus the pointer "argument" as address calculation only and thus costs it as such. To fix this IVOPTs needs to treat those internal functions as memory accesses and accordingly represent this to the target when building the fake RTL to cost (and there neither masks nor lens are considered). The GIMPLE in the end will have the address calculation split out (as if it could be CSEd between different references) to sth like _1 = &TARGET_MEM_REF <....>; .LEN_STORE (_1, ...); where &TARGET_MEM_REF <....> is then a LEA and the .LEN_STORE the simplest register indirect reference. Currently IVOPTs should get the LEA part right but it doesn't cost the simple register indirect reference. Of course in the end we'd like to anticipate merging the LEA with the .LEN_STORE (for the cases valid). Do I understand the issue is that only the last bit doesn't work but costing the LEA does?