https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114591

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
LRA starts with this:

    5: r98:SI=[`v1']
      REG_EQUIV [`v1']
    6: [`v2']=zero_extend(r98:SI)
    7: r101:HI=r98:SI#0
      REG_DEAD r98:SI
   12: ax:HI=r101:HI
      REG_DEAD r101:HI
   13: use ax:HI

then decides that:

      Removing equiv init insn 5 (freq=1000)
    5: r98:SI=[`v1']
      REG_EQUIV [`v1']

and substitutes all follow-up usages of r98 with a memory access. In insn 6, we
have:

(mem/c:SI (symbol_ref:DI ("v1")))

while in insn 7 we have:

(mem/c:HI (symbol_ref:DI ("v1")))

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.

Cc LRA expert ... oh, he already is in the loop.

Reply via email to