[llvm] [SelectionDAG] Fold low-prefix masked memops (PR #205118)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 22:03:46 PDT 2026


mygitljf wrote:

thanks.

The current fold only handles the case where the active low-prefix maps to a single legal narrower memory type. The 31-byte examples are different: replacing them with an unmasked 32-byte access would not be correct because the inactive byte must not be accessed or stored.

To fold these safely we would need exact-size chunked lowering, e.g. splitting the 31 active bytes into legal chunks, or a load-store-pair copy-style combine that still preserves the original load-before-store semantics. That is more than just relaxing the power-of-two check, since v31i8 is not a generally legal memory type and legalization must not widen the memory access to 32 bytes.

I can look into that as a follow-up, or extend this patch if you think the non-power-of-two prefix cases should be handled here as well.

https://github.com/llvm/llvm-project/pull/205118


More information about the llvm-commits mailing list