[llvm] [llvm] Optimize misaligned accesses with early profitable splitting (PR #145168)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 22 00:25:45 PDT 2025


nikic wrote:

> This is a good idea, but I still have the following questions: 1. MMO BaseAlign corresponds to IR Value, and MPI Offset is a constant. In order to obtain the optimal align info, we may need a new base + offset and introduce a new IR Value, which seems inappropriate.

It's not necessary to introduce a new IR value, it already exists: It's the pointer operand of a constant offset GEP.

> 2. The split in two parts in the SDAG legalization stage needs to be adapted and modified, otherwise it will be difficult to optimize the load/store based on the maximum alignment.

Yes, this is what I had in mind. Provide SDAG the necessary information so it can produce a better legalization, instead of splitting this into two different parts handled at two different layers.

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


More information about the llvm-commits mailing list