[PATCH] D157750: Properly handle -fsplit-machine-functions for fatbinary compilation

Han Shen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 12:40:06 PDT 2023


shenhan created this revision.
shenhan added reviewers: xur, snehasish.
Herald added subscribers: mattd, asavonic, pengfei, hiraditya.
Herald added a project: All.
shenhan requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

When building a fatbinary, the driver invokes the compiler multiple times with different "--target". (For example, with "-x cuda --cuda-gpu-arch=sm_70" flags, clang will be invoded twice, once with --target=x86_64_...., once with --target=sm_70) If we use -fsplit-machine-functions or -fno-split-machine-functions for such invocation, the driver reports an error.

This CL changes the behavior so:

1. "-fsplit-machine-functions" is now passed to all targets, for non-X86 targets, the flag is a NOOP and causes a warning.
2. "-fno-split-machine-functions" now negates -fsplit-machine-functions (if -fno-split-machine-functions appears after any -fsplit-machine-functions) for any target triple, previously, it causes an error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157750

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
  clang/test/Driver/fsplit-machine-functions.c
  clang/test/Driver/fsplit-machine-functions2.c
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/test/CodeGen/X86/mfs-triple.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157750.549493.patch
Type: text/x-patch
Size: 7034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230811/3f4fc226/attachment.bin>


More information about the cfe-commits mailing list