[PATCH] D103048: [IR] make -stack-alignment= into a module attr

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 14:28:31 PDT 2021


nickdesaulniers created this revision.
nickdesaulniers added reviewers: tejohnson, craig.topper, RKSimon.
Herald added subscribers: dexonsmith, pengfei, hiraditya, qcolombet.
nickdesaulniers requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Similar to D102742 <https://reviews.llvm.org/D102742>, specifying the stack alignment via CodegenOpts means
that this flag gets dropped during LTO, unless the command line is
respecified 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.

Curiously, using ModFlagBehavior::Error doesn't error if one of two
modules being linked together doesn't have such a module level
attribute.

Looks like external dependencies might need a fix:

- https://github.com/llvm-hs/llvm-hs
- https://github.com/halide/Halide

Link: https://github.com/ClangBuiltLinux/linux/issues/1377


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103048

Files:
  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/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/Generic/ForceStackAlign.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
  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
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103048.347500.patch
Type: text/x-patch
Size: 24902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210524/cdc36278/attachment-0001.bin>


More information about the llvm-commits mailing list