[CodeGen] Ensure callers of CreateStackTemporary use sensible alignments
authorDavid Sherwood <david.sherwood@arm.com>
Tue, 2 Jun 2020 10:16:23 +0000 (11:16 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Tue, 9 Jun 2020 07:10:17 +0000 (08:10 +0100)
commitcc8872400c3c0960e2673ea67ab6bcfcc9b3966b
tree277a28061e09b638d24488bf805c6f5dd4a2fbe4
parent37289615c01d08915626c58f825bc797c3a036e4
[CodeGen] Ensure callers of CreateStackTemporary use sensible alignments

In two instances of CreateStackTemporary we are sometimes promoting
alignments beyond the stack alignment. I have introduced a new function
called getReducedAlign that will return the alignment for the broken
down parts of illegal vector types. For example, on NEON a <32 x i8>
type is made up of two <16 x i8> types - in this case the sensible
alignment is 16 bytes, not 32.

In the legalization code wherever we create stack temporaries I have
started using the reduced alignments instead for illegal vector types.

I added a test to

  CodeGen/AArch64/build-one-lane.ll

that tries to insert an element into an illegal fixed vector type
that involves creating a temporary stack object.

Differential Revision: https://reviews.llvm.org/D80370
18 files changed:
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/AArch64/build-one-lane.ll
llvm/test/CodeGen/AMDGPU/scratch-simple.ll
llvm/test/CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot.ll
llvm/test/CodeGen/X86/avx512-insert-extract.ll
llvm/test/CodeGen/X86/extractelement-index.ll
llvm/test/CodeGen/X86/half.ll
llvm/test/CodeGen/X86/i64-mem-copy.ll
llvm/test/CodeGen/X86/insertelement-var-index.ll
llvm/test/CodeGen/X86/pr31088.ll
llvm/test/CodeGen/X86/var-permute-128.ll
llvm/test/CodeGen/X86/vec_fneg.ll
llvm/test/CodeGen/X86/vec_insert-4.ll
llvm/test/CodeGen/X86/vector-extend-inreg.ll