From 67f71f2b51244d83c8a0cb5fb86065cee1df6375 Mon Sep 17 00:00:00 2001 From: Patrick Quist Date: Sat, 10 Dec 2022 18:17:51 +0100 Subject: [PATCH] Support patched clang for faster opt-view (#4416) --- etc/config/c++.amazon.properties | 1 + lib/base-compiler.ts | 17 ++++++++++++++--- lib/compiler-finder.ts | 1 + types/compiler.interfaces.ts | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/etc/config/c++.amazon.properties b/etc/config/c++.amazon.properties index 58384456993..7b8a16cb5ec 100644 --- a/etc/config/c++.amazon.properties +++ b/etc/config/c++.amazon.properties @@ -350,6 +350,7 @@ group.clangx86trunk.ldPath=${exePath}/../lib|${exePath}/../lib/x86_64-unknown-li compiler.clang_trunk.exe=/opt/compiler-explorer/clang-trunk/bin/clang++ compiler.clang_trunk.semver=(trunk) +compiler.clang_trunk.debugPatched=true compiler.clang_assertions_trunk.exe=/opt/compiler-explorer/clang-assertions-trunk/bin/clang++ compiler.clang_assertions_trunk.semver=(assertions trunk) compiler.clang_concepts.exe=/opt/compiler-explorer/clang-concepts-trunk/bin/clang++ diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index 8f181193d80..146e7c0d5b3 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -1060,7 +1060,8 @@ export class BaseCompiler implements ICompiler { .filter(option => option !== '-fcolor-diagnostics') .concat(this.compiler.llvmOptArg) .concat(llvmOptPipelineOptions.fullModule ? this.compiler.llvmOptModuleScopeArg : []) - .concat(llvmOptPipelineOptions.noDiscardValueNames ? this.compiler.llvmOptNoDiscardValueNamesArg : []); + .concat(llvmOptPipelineOptions.noDiscardValueNames ? this.compiler.llvmOptNoDiscardValueNamesArg : []) + .concat(this.compiler.debugPatched ? ['-mllvm', '--debug-to-stdout'] : []); const execOptions = this.getDefaultExecOptions(); execOptions.maxOutput = 1024 * 1024 * 1024; @@ -1083,7 +1084,12 @@ export class BaseCompiler implements ICompiler { try { const parseStart = performance.now(); - const llvmOptPipeline = await this.processLLVMOptPipeline(output, filters, llvmOptPipelineOptions); + const llvmOptPipeline = await this.processLLVMOptPipeline( + output, + filters, + llvmOptPipelineOptions, + this.compiler.debugPatched, + ); const parseEnd = performance.now(); if (llvmOptPipelineOptions.demangle) { @@ -1117,8 +1123,13 @@ export class BaseCompiler implements ICompiler { output, filters: ParseFiltersAndOutputOptions, llvmOptPipelineOptions: LLVMOptPipelineBackendOptions, + debugPatched?: boolean, ) { - return this.llvmPassDumpParser.process(output.stderr, filters, llvmOptPipelineOptions); + return this.llvmPassDumpParser.process( + debugPatched ? output.stdout : output.stderr, + filters, + llvmOptPipelineOptions, + ); } getRustMacroExpansionOutputFilename(inputFilename) { diff --git a/lib/compiler-finder.ts b/lib/compiler-finder.ts index 64a57154e29..320b80abc6a 100644 --- a/lib/compiler-finder.ts +++ b/lib/compiler-finder.ts @@ -243,6 +243,7 @@ export class CompilerFinder { versionRe: props('versionRe'), explicitVersion: props('explicitVersion'), compilerType: props('compilerType', ''), + debugPatched: props('debugPatched', false), demangler: demangler, demanglerType: props('demanglerType', ''), nvdisasm: props('nvdisasm', ''), diff --git a/types/compiler.interfaces.ts b/types/compiler.interfaces.ts index a896a46ab30..78f072dd76c 100644 --- a/types/compiler.interfaces.ts +++ b/types/compiler.interfaces.ts @@ -38,6 +38,7 @@ export type CompilerInfo = { versionRe?: string; explicitVersion?: string; compilerType: string; + debugPatched: boolean; demangler: string; demanglerType: string; objdumper: string;