From 4bba4ba5bae3a18ea8cbde0e99ab2416bc0ea8e5 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sat, 24 Jun 2017 08:09:33 +0000 Subject: [PATCH] Ensure backends available in 'opt' are also available in 'bugpoint' This patch links LLVM back-ends into bugpoint the same way they are already available in 'opt' and 'clang'. This resolves an inconsistency that allowed the use of LLVM backends in loadable modules that run in 'opt', but that would prevent the debugging of these modules with bugpoint due to unavailable / unresolved symbols. For e.g. In D31859, Polly requires the NVPTX back-end. Reviewers: hfinkel, bogner, chandlerc, grosser, Meinersbur Subscribers: bollu, mgorny, grosser, Meinersbur Tags: #polly Contributed by: Singapuram Sanjay Differential Revision: https://reviews.llvm.org/D32003 llvm-svn: 306208 --- llvm/tools/bugpoint/CMakeLists.txt | 1 + llvm/tools/bugpoint/LLVMBuild.txt | 1 + llvm/tools/bugpoint/bugpoint.cpp | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/llvm/tools/bugpoint/CMakeLists.txt b/llvm/tools/bugpoint/CMakeLists.txt index 7598657427e8..8975e6763434 100644 --- a/llvm/tools/bugpoint/CMakeLists.txt +++ b/llvm/tools/bugpoint/CMakeLists.txt @@ -1,4 +1,5 @@ set(LLVM_LINK_COMPONENTS + ${LLVM_TARGETS_TO_BUILD} Analysis BitWriter CodeGen diff --git a/llvm/tools/bugpoint/LLVMBuild.txt b/llvm/tools/bugpoint/LLVMBuild.txt index 37a605870548..68ecb8c8f4f9 100644 --- a/llvm/tools/bugpoint/LLVMBuild.txt +++ b/llvm/tools/bugpoint/LLVMBuild.txt @@ -30,3 +30,4 @@ required_libraries = Linker ObjCARC Scalar + all-targets diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp index 85c1ddd8277d..a486342457c5 100644 --- a/llvm/tools/bugpoint/bugpoint.cpp +++ b/llvm/tools/bugpoint/bugpoint.cpp @@ -26,6 +26,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/TargetSelect.h" #include "llvm/Support/Valgrind.h" #include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" @@ -138,6 +139,14 @@ int main(int argc, char **argv) { polly::initializePollyPasses(Registry); #endif + if (std::getenv("bar") == (char*) -1) { + InitializeAllTargets(); + InitializeAllTargetMCs(); + InitializeAllAsmPrinters(); + InitializeAllAsmParsers(); + InitializeAllDisassemblers(); + } + cl::ParseCommandLineOptions(argc, argv, "LLVM automatic testcase reducer. See\nhttp://" "llvm.org/cmds/bugpoint.html" -- GitLab