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

2023-11-15 Thread Sergey Kachkov via cfe-commits
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

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

2023-11-15 Thread Nikita Popov via cfe-commits
https://github.com/nikic requested changes to this pull request. I don't like the overall approach of assembling this from individual byte-sized loads here. What I would expect to see is more something along these lines: If we find a clobbering store that a) only clobbers some subset of the loa