[PATCH] D79532: [SelectionDAG] Don't promote the alignment of allocas beyond the stack alignment.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 6 17:38:22 PDT 2020
efriedma created this revision.
efriedma added reviewers: arsenm, craig.topper, sdesmalen.
Herald added subscribers: kerbowa, dmgreen, arphaman, hiraditya, nhaehnle, wdng, jvesely.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.
efriedma added a subscriber: simon_tatham.
allocas in LLVM IR have a specified alignment. When that alignment is specified, the alloca has at least that alignment at runtime.
If the specified type of the alloca has a higher preferred alignment, SelectionDAG currently ignores that specified alignment, and increases the alignment. It does this even if it would trigger stack realignment. I don't think this makes sense, so this patch changes that.
I was looking into this for SVE in particular: for SVE, overaligning vscale'ed types is extra expensive because it requires realigning the stack multiple times, or using dynamic allocation. (This currently isn't implemented.)
I updated the expected assembly for a couple tests; in particular, for arg-copy-elide.ll, the optimization in question does not increase the alignment the way SelectionDAG normally would. For the rest, I just increased the specified alignment on the allocas to match what SelectionDAG was inferring.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79532
Files:
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/test/CodeGen/AArch64/sve-alloca-stackid.ll
llvm/test/CodeGen/AMDGPU/private-element-size.ll
llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll
llvm/test/CodeGen/ARM/alloc-no-stack-realign.ll
llvm/test/CodeGen/Thumb2/mve-basic.ll
llvm/test/CodeGen/X86/arg-copy-elide.ll
llvm/test/CodeGen/X86/avx2-vbroadcast.ll
llvm/test/CodeGen/X86/avx512-intel-ocl.ll
llvm/test/CodeGen/X86/movtopush.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79532.262463.patch
Type: text/x-patch
Size: 10885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200507/89f74e65/attachment.bin>
More information about the llvm-commits
mailing list