Skip to content

Commit

Permalink
Support patched clang for faster opt-view (#4416)
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Dec 10, 2022
1 parent f598cf8 commit 67f71f2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions etc/config/c++.amazon.properties
Expand Up @@ -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++
Expand Down
17 changes: 14 additions & 3 deletions lib/base-compiler.ts
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions lib/compiler-finder.ts
Expand Up @@ -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', ''),
Expand Down
1 change: 1 addition & 0 deletions types/compiler.interfaces.ts
Expand Up @@ -38,6 +38,7 @@ export type CompilerInfo = {
versionRe?: string;
explicitVersion?: string;
compilerType: string;
debugPatched: boolean;
demangler: string;
demanglerType: string;
objdumper: string;
Expand Down

0 comments on commit 67f71f2

Please sign in to comment.