[all-commits] [llvm/llvm-project] c9c930: [SelectionDAG] Don't promote the alignment of allo...

Eli Friedman via All-commits all-commits at lists.llvm.org
Mon May 11 17:40:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c9c930ae67c38b93451aa979de723723aec0067d
      https://github.com/llvm/llvm-project/commit/c9c930ae67c38b93451aa979de723723aec0067d
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2020-05-11 (Mon, 11 May 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
    M llvm/test/CodeGen/AArch64/sve-alloca-stackid.ll
    M llvm/test/CodeGen/AMDGPU/private-element-size.ll
    M llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll
    M llvm/test/CodeGen/ARM/alloc-no-stack-realign.ll
    M llvm/test/CodeGen/Thumb2/mve-basic.ll
    M llvm/test/CodeGen/X86/arg-copy-elide.ll
    M llvm/test/CodeGen/X86/avx2-vbroadcast.ll
    M llvm/test/CodeGen/X86/avx512-intel-ocl.ll
    M llvm/test/CodeGen/X86/load-local-v3i129.ll
    M llvm/test/CodeGen/X86/movtopush.ll

  Log Message:
  -----------
  [SelectionDAG] Don't promote the alignment of allocas beyond the stack alignment.

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.

Differential Revision: https://reviews.llvm.org/D79532




More information about the All-commits mailing list