reland [IR] make -stack-alignment= into a module attr
authorNick Desaulniers <ndesaulniers@google.com>
Tue, 8 Jun 2021 15:57:12 +0000 (08:57 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Tue, 8 Jun 2021 17:59:46 +0000 (10:59 -0700)
commit3787ee457173c3612aac4c9b1a2b6d6ab0202616
tree797092b2a5aa7bb39a3ae620b244dad81dc85a62
parentee2a92c29df6d37a4dc5d0f6795f0fe531962b9d
reland [IR] make -stack-alignment= into a module attr

Relands commit 433c8d950cb3a1fa0977355ce0367e8c763a3f13 with fixes for
MIPS.

Similar to D102742, specifying the stack alignment via CodegenOpts means
that this flag gets dropped during LTO, unless the command line is
re-specified as a plugin opt. Instead, encode this information as a
module level attribute so that we don't have to expose this llvm
internal flag when linking the Linux kernel with LTO.

Looks like external dependencies might need a fix:
* https://github.com/llvm-hs/llvm-hs/issues/345
* https://github.com/halide/Halide/issues/6079

Link: https://github.com/ClangBuiltLinux/linux/issues/1377
Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D103048
26 files changed:
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/stackrealign-main.c
llvm/include/llvm/IR/Module.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/CommandFlags.cpp
llvm/lib/IR/Module.cpp
llvm/lib/Target/Mips/MipsCallLowering.cpp
llvm/lib/Target/Mips/MipsTargetMachine.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/Generic/ForceStackAlign.ll
llvm/test/CodeGen/Mips/stack-alignment.ll
llvm/test/CodeGen/X86/base-pointer-and-cmpxchg.ll
llvm/test/CodeGen/X86/base-pointer-and-mwaitx.ll
llvm/test/CodeGen/X86/dynamic-allocas-VLAs-stack-align.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll
llvm/test/CodeGen/X86/force-align-stack-alloca.ll
llvm/test/CodeGen/X86/hipe-cc.ll
llvm/test/CodeGen/X86/hipe-cc64.ll
llvm/test/CodeGen/X86/movtopush-stack-align.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/movtopush.ll
llvm/test/CodeGen/X86/pr11468.ll
llvm/test/CodeGen/X86/unaligned-spill-folding.ll
llvm/test/CodeGen/X86/x86-64-baseptr.ll
llvm/test/CodeGen/X86/x86-64-xmm-spill-unaligned.ll
llvm/test/Linker/stack-alignment.ll [new file with mode: 0644]