[clang] [llvm] split load to bytes to deduce load value (PR #72364)

Sergey Kachkov via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 02:59:26 PST 2023


skachkov-sc wrote:

I think we should also check this optimization for non-byte stores, e.g.
```
define i32 @f(ptr %ptr)
    %ptr1 = getelementptr inbounds i8, ptr %ptr, i64 2
    store i16 0, ptr %ptr, align 2
    store i16 0, ptr %ptr1, align 2
    %L = load i32, ptr %ptr, align 4
```
GVN should optimize the case when 1-byte load location is fully covered with 2-byte store and extract the required byte from stored value, but it's good to check if reconstruction of 4-byte %L can be simplified after.

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


More information about the cfe-commits mailing list