Skip to content

Commit 3a6cc61

Browse files
committed
[Comgr] Pass -no-disable-free to Clang
The clang driver passes -disable-free to speedup clang's process by skipping destructors at exit. This is problematic for Comgr since we do not want to leak memory at every compilation. Before this patch, we worked around this issue by removing the -disable-free flag from the the Job arguments. In this patch, we pass -no-disable-free to the driver. When we pass -no-disable-free, both flags are passed but -no-disable-free is picked since it's the last option related to disable-free in the command line. Then, we can remove the previous hack.
1 parent b23aa4e commit 3a6cc61

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

amd/comgr/src/comgr-compiler.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -649,12 +649,6 @@ amd_comgr_status_t executeCommand(const Command &Job, raw_ostream &LogS,
649649
Argv.append(Arguments.begin(), Arguments.end());
650650
Argv.push_back(nullptr);
651651

652-
// By default clang driver will ask CC1 to leak memory.
653-
auto *IT = find(Argv, StringRef("-disable-free"));
654-
if (IT != Argv.end()) {
655-
Argv.erase(IT);
656-
}
657-
658652
clearLLVMOptions();
659653

660654
if (Argv[1] == StringRef("-cc1")) {
@@ -900,6 +894,10 @@ amd_comgr_status_t AMDGPUCompiler::processFile(DataObject *Input,
900894
Argv.push_back(Flag);
901895
}
902896

897+
// By default clang driver will ask CC1 to leak memory.
898+
Argv.push_back("-Xclang");
899+
Argv.push_back("-no-disable-free");
900+
903901
Argv.push_back(InputFilePath);
904902

905903
Argv.push_back("-o");

0 commit comments

Comments
 (0)