diff options
author | Chengjun <chengjunp@Nvidia.com> | 2025-10-10 17:23:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-11 00:23:04 +0000 |
commit | 8faeed042af2c1278cc71f0a5ef1a4d45f905eb8 (patch) | |
tree | e9daa62b6df01e9c603f8bf49e0b60caa128e7bf /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | d3233e806e1a80020b09c161def31ce2c75804d5 (diff) | |
download | llvm-8faeed042af2c1278cc71f0a5ef1a4d45f905eb8.zip llvm-8faeed042af2c1278cc71f0a5ef1a4d45f905eb8.tar.gz llvm-8faeed042af2c1278cc71f0a5ef1a4d45f905eb8.tar.bz2 |
[SROA] Add Stored Value Size Check for Tree-Structured Merge (#162921)
The change fixes a bug in the SROA where tree-structured merge
optimization was incorrectly applied when the size of the stored value
was not a multiple of the new allocated element type size. The original
change is https://github.com/llvm/llvm-project/pull/152793. A simple
repro would be
```
define <1 x i32> @foo(<1 x i16> %a, <1 x i16> %b) {
entry:
%alloca = alloca [1 x i32]
%ptr0 = getelementptr inbounds [2 x i16], ptr %alloca, i32 0, i32 0
store <1 x i16> %a, ptr %ptr0
%ptr1 = getelementptr inbounds [2 x i16], ptr %alloca, i32 0, i32 1
store <1 x i16> %b, ptr %ptr1
%result = load <1 x i32>, ptr %alloca
ret <1 x i32> %result
}
```
Currently, this will lead to a compile time crash.
In this change, we will skip the tree-structured merge for this case and
fall back to normal SROA.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions