summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2019-05-06 23:24:17 +0000
committerPetr Hosek <phosek@chromium.org>2019-05-06 23:24:17 +0000
commit5f2e10e9c3251f623d9962984a34ae40bb84b1ff (patch)
treeb16b4fcd9c9017544aeeb16e857f1bb13e22019e /clang
parent2ea088173df0d44db3202b6b2904901c0a6dabe5 (diff)
downloadbcm5719-llvm-5f2e10e9c3251f623d9962984a34ae40bb84b1ff.tar.gz
bcm5719-llvm-5f2e10e9c3251f623d9962984a34ae40bb84b1ff.zip
[Clang][NewPM] Don't bail out if the target machine is empty
This matches the behavior of the old pass manager. There are some targets that don't have target machine at all (e.g. le32, spir) which whose tests would never run with new pass manager. Similarly, we would need to disable tests for targets that are disabled. Differential Revision: https://reviews.llvm.org/D58374 llvm-svn: 360100
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp14
-rw-r--r--clang/test/CodeGen/spir-half-type.cpp2
-rw-r--r--clang/test/Driver/le32-unknown-nacl.cpp1
3 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index a43ebe9a2e0..cd2a5f6fa3f 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -965,13 +965,15 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
TimeRegion Region(FrontendTimesIsEnabled ? &CodeGenerationTime : nullptr);
setCommandLineOpts(CodeGenOpts);
- // The new pass manager always makes a target machine available to passes
- // during construction.
- CreateTargetMachine(/*MustCreateTM*/ true);
- if (!TM)
- // This will already be diagnosed, just bail.
+ bool RequiresCodeGen = (Action != Backend_EmitNothing &&
+ Action != Backend_EmitBC &&
+ Action != Backend_EmitLL);
+ CreateTargetMachine(RequiresCodeGen);
+
+ if (RequiresCodeGen && !TM)
return;
- TheModule->setDataLayout(TM->createDataLayout());
+ if (TM)
+ TheModule->setDataLayout(TM->createDataLayout());
Optional<PGOOptions> PGOOpt;
diff --git a/clang/test/CodeGen/spir-half-type.cpp b/clang/test/CodeGen/spir-half-type.cpp
index b60931fea6e..5cdc38e9979 100644
--- a/clang/test/CodeGen/spir-half-type.cpp
+++ b/clang/test/CodeGen/spir-half-type.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -O0 -triple spir -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -O0 -triple spir64 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O0 -triple spir -fexperimental-new-pass-manager -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O0 -triple spir64 -fexperimental-new-pass-manager -emit-llvm %s -o - | FileCheck %s
// This file tests that using the _Float16 type with the spir target will not
// use the llvm intrinsics but instead will use the half arithmetic
diff --git a/clang/test/Driver/le32-unknown-nacl.cpp b/clang/test/Driver/le32-unknown-nacl.cpp
index 9bbcdec037b..95d74878d1d 100644
--- a/clang/test/Driver/le32-unknown-nacl.cpp
+++ b/clang/test/Driver/le32-unknown-nacl.cpp
@@ -1,5 +1,6 @@
// RUN: %clang -target le32-unknown-nacl -### %s -emit-llvm-only -c 2>&1 | FileCheck %s -check-prefix=ECHO
// RUN: %clang -target le32-unknown-nacl %s -emit-llvm -S -c -o - | FileCheck %s
+// RUN: %clang -target le32-unknown-nacl -fexperimental-new-pass-manager %s -emit-llvm -S -c -o - | FileCheck %s
// RUN: %clang -target le32-unknown-nacl %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
// ECHO: {{.*}} "-cc1" {{.*}}le32-unknown-nacl.c
OpenPOWER on IntegriCloud