https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114591
--- Comment #9 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- > > It looks that different modes of memory read confuse LRA to not CSE the read. > > IMO, if the preloaded value is later accessed in different modes, LRA should > leave it. Alternatively, LRA should CSE memory accesses in different modes. (insn 7 6 12 2 (set (reg:HI 101 [ _5 ]) (subreg:HI (reg:SI 98 [ v1.0_1 ]) 0)) "test.c":6:12 86 {*movhi_internal} (expr_list:REG_DEAD (reg:SI 98 [ v1.0_1 ]) (nil))) May be we should reduce cost from simple move instruction(with subreg?) when calculating total_cost, since it's probably be eliminated by later rtl optimization.