Index: tools/bugpoint/CMakeLists.txt =================================================================== --- tools/bugpoint/CMakeLists.txt +++ tools/bugpoint/CMakeLists.txt @@ -16,6 +16,10 @@ Vectorize ) +if (NOT LINK_POLLY_INTO_TOOLS) + list(APPEND LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD}) +endif (NOT LINK_POLLY_INTO_TOOLS) + # Support plugins. set(LLVM_NO_DEAD_STRIP 1) @@ -35,8 +39,8 @@ ) export_executable_symbols(bugpoint) -if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS) +if (LINK_POLLY_INTO_TOOLS) target_link_libraries(bugpoint Polly) # Ensure LLVMTarget can resolve dependences in Polly. target_link_libraries(bugpoint LLVMTarget) -endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS) +endif (LINK_POLLY_INTO_TOOLS) Index: tools/bugpoint/LLVMBuild.txt =================================================================== --- tools/bugpoint/LLVMBuild.txt +++ tools/bugpoint/LLVMBuild.txt @@ -30,3 +30,4 @@ Linker ObjCARC Scalar + all-targets Index: tools/bugpoint/bugpoint.cpp =================================================================== --- tools/bugpoint/bugpoint.cpp +++ 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,15 @@ polly::initializePollyPasses(Registry); #endif +#ifndef LINK_POLLY_INTO_TOOLS + if (std::getenv("bar") == (char*) -1) { + InitializeAllTargets(); + InitializeAllTargetMCs(); + InitializeAllAsmPrinters(); + } +#endif + + cl::ParseCommandLineOptions(argc, argv, "LLVM automatic testcase reducer. See\nhttp://" "llvm.org/cmds/bugpoint.html"