[PATCH] D112413: [X86] Add -mskip-rax-setup support to align with GCC

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 15:59:53 PDT 2021


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:96
 
+static cl::opt<bool> SkipRaxSetup(
+    "x86-skip-rax-setup", cl::init(false),
----------------
MaskRay wrote:
> nickdesaulniers wrote:
> > If it's a command line option rather than encoded in the IR, then this won't be handled correctly under LTO (we support building the x86 linux kernel under LTO), unless the linker re-passes the flag.  I've been trying to avoid that by encoding this information properly in IR rather than rely on codegen command line options which I find brittle.  Please see https://reviews.llvm.org/D103928 as an example.
> This depends on how frequent the feature is used.
> 
> I see that `arch/x86/Makefile` may add `-mskip-rax-setup` which is presumably used by all C files, so a module flag metadata suffices. If there are mix-and-match cases for different modules (e.g. ssp/nossp) a function attribute may be used. If a feature is really obscure than I might not consider wasting an IR attribute on it. Arguably if a feature is sufficient obscure we may not want to port it from GCC at all.
> 
> So "This fixes pr23258." in the description should state the use case to give archaeologists a hint why the feature is added.
That's fine, though then we should add a test for new module level IR using llvm-link, IMO, since this (and many `-m` flags) imply an ABI breakage across modules with mismatched use of this flag.

> Arguably if a feature is sufficient obscure we may not want to port it from GCC at all.

In this case, I think at hjl.tools has some nice numbers to justify this feature in [[ https://patchwork.ozlabs.org/project/gcc/patch/20141218131150.GA32638@intel.com/ | their patch ]]. I can run similar numbers on clang built kernels, but it seems nice to have.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112413/new/

https://reviews.llvm.org/D112413



More information about the llvm-commits mailing list