[PATCH] D58374: [Clang][NewPM] Don't bail out if the target machine is empty

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 6 16:22:57 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC360100: [Clang][NewPM] Don't bail out if the target machine is empty (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58374?vs=188999&id=198367#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58374/new/

https://reviews.llvm.org/D58374

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/spir-half-type.cpp
  test/Driver/le32-unknown-nacl.cpp


Index: test/Driver/le32-unknown-nacl.cpp
===================================================================
--- test/Driver/le32-unknown-nacl.cpp
+++ 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
Index: test/CodeGen/spir-half-type.cpp
===================================================================
--- test/CodeGen/spir-half-type.cpp
+++ 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
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -965,13 +965,15 @@
   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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58374.198367.patch
Type: text/x-patch
Size: 2297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190506/0dbcf4d4/attachment.bin>


More information about the cfe-commits mailing list