diff options
author | sallto <68823230+sallto@users.noreply.github.com> | 2025-04-26 21:38:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-26 21:38:58 +0200 |
commit | 419a2cb218245b90ace9e0a460d94057e7091002 (patch) | |
tree | 017df6e5966b52995fdd589d8defd3f89dc7dc19 /llvm/lib/CodeGen/LiveDebugVariables.cpp | |
parent | 2f08927fd5f44418482dd583d3d451acc6669fe6 (diff) | |
download | llvm-419a2cb218245b90ace9e0a460d94057e7091002.zip llvm-419a2cb218245b90ace9e0a460d94057e7091002.tar.gz llvm-419a2cb218245b90ace9e0a460d94057e7091002.tar.bz2 |
[Inliner] Preserve alignment of byval arguments (#137455)
Previously the inliner always produced a memcpy with alignment 1 for src
and destination, leading to potentially suboptimal Codegen.
Since the Src ptr alignment is only available through the CallBase it
has to be passed to HandleByValArgumentInit. Dst Alignment is already
known so it doesn't have to be passed along.
If there is no specified Src Alignment my changes cause the ptr to have
no align data attached instead of align 1 as before (see
inline-tail.ll), I believe this is fine but since I'm a first time
contributor, please confirm.
My changes are already covered by 4 existing regression tests, so I did
not add any additional ones.
The example from #45778 now results in:
```C
opt -S -passes=inline,instcombine,sroa,instcombine test.ll
define dso_local i32 @test(ptr %t) {
entry:
%.sroa.0.0.copyload = load ptr, ptr %t, align 8 # this used to be align 1 in the original issue
%arrayidx.i = getelementptr inbounds nuw i8, ptr %.sroa.0.0.copyload, i64 24
%0 = load i32, ptr %arrayidx.i, align 4
ret i32 %0
}
```
Fixes #45778.
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
0 files changed, 0 insertions, 0 deletions