[clang] bc7df03 - Make -fintegrated-cc1 work with cc1as
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 14 01:16:24 PST 2020
Author: Fangrui Song
Date: 2020-11-14T01:16:16-08:00
New Revision: bc7df035ae68648fe39304d9e77cd7618812cca8
URL: https://github.com/llvm/llvm-project/commit/bc7df035ae68648fe39304d9e77cd7618812cca8
DIFF: https://github.com/llvm/llvm-project/commit/bc7df035ae68648fe39304d9e77cd7618812cca8.diff
LOG: Make -fintegrated-cc1 work with cc1as
Tested 0.018s faster on my machine.
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/cc1-spawnprocess.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index c8d58f0a5b9a..9ef408f42eff 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7186,9 +7186,16 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Input.getFilename());
const char *Exec = getToolChain().getDriver().getClangProgramPath();
- C.addCommand(std::make_unique<Command>(JA, *this,
- ResponseFileSupport::AtFileUTF8(),
- Exec, CmdArgs, Inputs, Output));
+ if (D.CC1Main && !D.CCGenDiagnostics) {
+ // Invoke cc1as directly in this process.
+ C.addCommand(std::make_unique<CC1Command>(JA, *this,
+ ResponseFileSupport::AtFileUTF8(),
+ Exec, CmdArgs, Inputs, Output));
+ } else {
+ C.addCommand(std::make_unique<Command>(JA, *this,
+ ResponseFileSupport::AtFileUTF8(),
+ Exec, CmdArgs, Inputs, Output));
+ }
}
// Begin OffloadBundler
diff --git a/clang/test/Driver/cc1-spawnprocess.c b/clang/test/Driver/cc1-spawnprocess.c
index 36df7067487c..7f6dad66f309 100644
--- a/clang/test/Driver/cc1-spawnprocess.c
+++ b/clang/test/Driver/cc1-spawnprocess.c
@@ -40,3 +40,8 @@
// Three jobs, thus integrated-cc1 is disabled.
// RUN: %clang -fintegrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=NO
+
+// -fintegrated-cc1 works with cc1as.
+// RUN: echo > %t.s
+// RUN: %clang -fintegrated-cc1 -fintegrated-as -c -### %t.s 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fno-integrated-cc1 -c -### %t.s 2>&1 | FileCheck %s --check-prefix=NO
More information about the cfe-commits
mailing list