[PATCH] D136456: [SelectionDAG] Clamp stack alignment for memset, memmove

Haohai, Wen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 08:24:48 PDT 2022


HaohaiWen created this revision.
Herald added subscribers: ecnelises, pengfei, mstorsjo, hiraditya.
Herald added a project: All.
HaohaiWen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

memcpy has clamped dst stack alignment to NaturalStackAlignment if
hasStackRealignment is false. We should also clamp stack alignment
for memset and memmove. If we don't clamp, SelectionDAG may first
do tail call optimization which requires no stack realignment. Then
memmove, memset in same function may be lowered to load/store with
larger alignment leading to PEI emit stack realignment code which
is absolutely not correct.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136456

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/X86/memset-sse-stack-realignment.ll
  llvm/test/CodeGen/X86/memset.ll
  llvm/test/CodeGen/X86/pr42064.ll
  llvm/test/DebugInfo/COFF/frameproc-flags.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136456.469620.patch
Type: text/x-patch
Size: 4875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221021/5418eaaf/attachment.bin>


More information about the llvm-commits mailing list