-fsplit-machine-functions is an optimization in codegen phase. when -flto is use, clang generate IR bitcode in .o files, and linker will call into these codegen optimization passes. Current clang driver doesn't pass this option to linker when both -fsplit-machine-functions and -flto are used, so the optimization is silently ignored. My fix generates linker option -plugin-opt=-split-machine-functions for this case. It allows the linker to pass "split-machine-functions" to code generator to turn on that optimization. It works for both gold and lld.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/test/Driver/split-machine-functions.c | ||
---|---|---|
2 ↗ | (On Diff #416555) | My understanding is that if you specify target, e.g. -target x86_64-unknown-linux, the test should still be runnable on windows host platform. |
clang/lib/Driver/ToolChains/CommonArgs.cpp | ||
---|---|---|
577 | Should also check OPT_fno_split_machine_functions, i.e, if (Args.getLastArg(options::OPT_fsplit_machine_functions, options::OPT_fno_split_machine_functions)) | |
clang/test/Driver/fsplit-machine-functions2.c | ||
6 | Please add a test case for mixed -fsplit-machine-functions and -fno-split-machine-functions |
Should also check OPT_fno_split_machine_functions, i.e,