Drop LLVM profiling frags from Clang invocation

It is not needed in most cases, but may affect profile
when running compiler with -Xprofile-phases.
This commit is contained in:
Sergey Bogolepov
2021-04-07 17:22:13 +07:00
committed by Space
parent b18cd24b81
commit 9e6cf11026
@@ -50,8 +50,6 @@ internal class BitcodeCompiler(val context: Context) {
private fun clang(configurables: ClangFlags, file: BitcodeFile): ObjectFile { private fun clang(configurables: ClangFlags, file: BitcodeFile): ObjectFile {
val objectFile = temporary("result", ".o") val objectFile = temporary("result", ".o")
val profilingFlags = llvmProfilingFlags().map { listOf("-mllvm", it) }.flatten()
// TODO: fix with LLVM update. // TODO: fix with LLVM update.
val targetTriple = when (context.config.target) { val targetTriple = when (context.config.target) {
// LLVM we use does not have support for arm64_32. // LLVM we use does not have support for arm64_32.
@@ -81,7 +79,6 @@ internal class BitcodeCompiler(val context: Context) {
}) })
addNonEmpty(BitcodeEmbedding.getClangOptions(context.config)) addNonEmpty(BitcodeEmbedding.getClangOptions(context.config))
addNonEmpty(configurables.currentRelocationMode(context).translateToClangCc1Flag()) addNonEmpty(configurables.currentRelocationMode(context).translateToClangCc1Flag())
addNonEmpty(profilingFlags)
} }
if (configurables is AppleConfigurables) { if (configurables is AppleConfigurables) {
targetTool("clang++", *flags.toTypedArray(), file, "-o", objectFile) targetTool("clang++", *flags.toTypedArray(), file, "-o", objectFile)
@@ -97,17 +94,6 @@ internal class BitcodeCompiler(val context: Context) {
RelocationModeFlags.Mode.DEFAULT -> emptyList() RelocationModeFlags.Mode.DEFAULT -> emptyList()
} }
private fun llvmProfilingFlags(): List<String> {
val flags = mutableListOf<String>()
if (context.shouldProfilePhases()) {
flags += "-time-passes"
}
if (context.inVerbosePhase) {
flags += "-debug-pass=Structure"
}
return flags
}
fun makeObjectFiles(bitcodeFile: BitcodeFile): List<ObjectFile> = fun makeObjectFiles(bitcodeFile: BitcodeFile): List<ObjectFile> =
listOf(when (val configurables = platform.configurables) { listOf(when (val configurables = platform.configurables) {
is ClangFlags -> clang(configurables, bitcodeFile) is ClangFlags -> clang(configurables, bitcodeFile)