On 11/19/25 7:37 AM, Konstantinos Eleftheriou wrote:
Sometimes, `store_bit_field` copies the destination register into a new one,
which leads to the old register being used in the instructions that follow
the ones generated by `store_bit_field`, while the bit field insertion is
performed on the new register.
This patch copies back the new destination register into the old one when
needed.
gcc/ChangeLog:
* avoid-store-forwarding.cc (generate_bit_insert_sequence):
Copy back the new destination register into the old one when needed.
This sounds more like a bit in store_bit_field. It's stated purpose is
to store the source field into an object. I'd really like to understand
in detail the scenario in which str_rtx does not contain the right value
after a call to store_bit_field.
I can certainly believe we may have a problem here though -- many
routines are defined as putting their result into a given target pseudo
*if it's convenient* to do so, but leave it up to the caller to handle
the case where that doesn't happen. I could easily see something in the
bowels of store_bit_field or its children getting semantics wrong
because of that.
Jeff