[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 Feb 18 23:13:34 PST 2019
phosek created this revision.
phosek added a reviewer: chandlerc.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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.
Repository:
rC Clang
https://reviews.llvm.org/D58374
Files:
clang/lib/CodeGen/BackendUtil.cpp
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -947,13 +947,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 UsesCodeGen = (Action != Backend_EmitNothing &&
+ Action != Backend_EmitBC &&
+ Action != Backend_EmitLL);
+ CreateTargetMachine(UsesCodeGen);
+
+ if (UsesCodeGen && !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.187312.patch
Type: text/x-patch
Size: 928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190219/ea35ebe9/attachment.bin>
More information about the cfe-commits
mailing list