summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-04-02 08:54:30 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-04-02 08:54:30 +0000
commit20e856b2a58d12231aa42d5d13888b15ac03e5a4 (patch)
treecf5763d092b81cecc168fa28032247ee495d06e2 /tools
parent2f2afc1aae898651e26987a5c71f3febb19bca98 (diff)
downloadFreeBSD-src-20e856b2a58d12231aa42d5d13888b15ac03e5a4.zip
FreeBSD-src-20e856b2a58d12231aa42d5d13888b15ac03e5a4.tar.gz
Update LLVM to r100181.
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile8
-rw-r--r--tools/bugpoint/BugDriver.cpp5
-rw-r--r--tools/bugpoint/BugDriver.h1
-rw-r--r--tools/edis/Makefile17
-rw-r--r--tools/llc/llc.cpp4
-rw-r--r--tools/llvm-extract/llvm-extract.cpp1
-rw-r--r--tools/llvm-ld/Optimize.cpp5
-rw-r--r--tools/llvm-ld/llvm-ld.cpp139
-rw-r--r--tools/llvm-link/llvm-link.cpp1
-rw-r--r--tools/llvm-mc/llvm-mc.cpp10
-rw-r--r--tools/llvmc/plugins/Base/Base.td.in2
-rw-r--r--tools/lto/LTOCodeGenerator.cpp4
-rw-r--r--tools/opt/opt.cpp5
13 files changed, 104 insertions, 98 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 5813057..e124422 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -22,7 +22,6 @@ PARALLEL_DIRS := opt llvm-as llvm-dis \
lli llvm-extract \
bugpoint llvm-bcanalyzer llvm-stub \
llvm-mc llvmc
-
# Let users override the set of tools to build from the command line.
ifdef ONLY_TOOLS
@@ -38,7 +37,7 @@ ifeq ($(ENABLE_PIC),1)
# No support for dynamic libraries on windows targets.
ifneq ($(TARGET_OS), $(filter $(TARGET_OS), Cygwin MingW))
PARALLEL_DIRS += edis
-
+
# gold only builds if binutils is around. It requires "lto" to build before
# it so it is added to DIRS.
ifdef BINUTILS_INCDIR
@@ -54,4 +53,9 @@ ifeq ($(filter $(TARGETS_TO_BUILD), X86),)
PARALLEL_DIRS := $(filter-out edis, $(PARALLEL_DIRS))
endif
+# Don't build edis if we explicitly disabled it.
+ifeq ($(DISABLE_EDIS),1)
+ PARALLEL_DIRS := $(filter-out edis, $(PARALLEL_DIRS))
+endif
+
include $(LEVEL)/Makefile.common
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index 813c96c..d676a43 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -21,7 +21,6 @@
#include "llvm/Support/IRReader.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Host.h"
@@ -75,6 +74,10 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs,
run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout),
MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
+BugDriver::~BugDriver() {
+ delete Program;
+}
+
/// ParseInputFile - Given a bitcode or assembly input filename, parse and
/// return it, or return null if not possible.
diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h
index 0a10a61..abc2498 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -65,6 +65,7 @@ public:
BugDriver(const char *toolname, bool as_child, bool find_bugs,
unsigned timeout, unsigned memlimit, bool use_valgrind,
LLVMContext& ctxt);
+ ~BugDriver();
const char *getToolName() const { return ToolName; }
diff --git a/tools/edis/Makefile b/tools/edis/Makefile
index cd8f4b0..7f7b097 100644
--- a/tools/edis/Makefile
+++ b/tools/edis/Makefile
@@ -25,26 +25,23 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) x86asmprinter x86disassembler
include $(LEVEL)/Makefile.common
ifeq ($(HOST_OS),Darwin)
- # set dylib internal version number to llvmCore submission number
- ifdef LLVM_SUBMIT_VERSION
- LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
- -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
- -Wl,-compatibility_version -Wl,1
- endif
# extra options to override libtool defaults
LLVMLibsOptions := $(LLVMLibsOptions) \
-avoid-version \
-Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/EnhancedDisassembly.exports \
- -Wl,-dead_strip \
- -Wl,-seg1addr -Wl,0xE0000000
+ -Wl,-dead_strip
+
+ ifdef EDIS_VERSION
+ LLVMLibsOptions := -Wl,-current_version -Wl,$(EDIS_VERSION) \
+ -Wl,-compatibility_version -Wl,1
+ endif
# Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
- # Path is /Developer/usr/local/lib for now; will use an rpath-based mechanism soon
DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
ifneq ($(DARWIN_VERS),8)
LLVMLibsOptions := $(LLVMLibsOptions) \
-no-undefined -Wl,-install_name \
- -Wl,"/Developer/usr/local/lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
+ -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
endif
endif
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 810ba42..aa977a7 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -23,13 +23,10 @@
#include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
#include "llvm/CodeGen/LinkAllCodegenComponents.h"
#include "llvm/Config/config.h"
-#include "llvm/LinkAllVMCore.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/System/Host.h"
@@ -39,7 +36,6 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/Scalar.h"
#include <memory>
using namespace llvm;
diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp
index 231634c..276dfd6 100644
--- a/tools/llvm-extract/llvm-extract.cpp
+++ b/tools/llvm-extract/llvm-extract.cpp
@@ -22,7 +22,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/IRReader.h"
#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SystemUtils.h"
diff --git a/tools/llvm-ld/Optimize.cpp b/tools/llvm-ld/Optimize.cpp
index 6143dc8..3fb0079 100644
--- a/tools/llvm-ld/Optimize.cpp
+++ b/tools/llvm-ld/Optimize.cpp
@@ -13,17 +13,12 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
-#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/LoopPass.h"
-#include "llvm/Analysis/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/StandardPasses.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/DynamicLibrary.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Transforms/IPO.h"
-#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/PassNameParser.h"
#include "llvm/Support/PluginLoader.h"
using namespace llvm;
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index 118f6b7..29b74b8 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -125,13 +125,18 @@ static cl::opt<std::string> CO9("m", cl::Hidden,
/// everywhere.
static std::string progname;
+/// FileRemover objects to clean up output files in the event of an error.
+static FileRemover OutputRemover;
+static FileRemover BitcodeOutputRemover;
+
/// PrintAndExit - Prints a message to standard error and exits with error code
///
/// Inputs:
/// Message - The message to print to standard error.
///
-static void PrintAndExit(const std::string &Message, int errcode = 1) {
+static void PrintAndExit(const std::string &Message, Module *M, int errcode = 1) {
errs() << progname << ": " << Message << "\n";
+ delete M;
llvm_shutdown();
exit(errcode);
}
@@ -234,17 +239,10 @@ void GenerateBitcode(Module* M, const std::string& FileName) {
raw_fd_ostream Out(FileName.c_str(), ErrorInfo,
raw_fd_ostream::F_Binary);
if (!ErrorInfo.empty())
- PrintAndExit(ErrorInfo);
-
- // Ensure that the bitcode file gets removed from the disk if we get a
- // terminating signal.
- sys::RemoveFileOnSignal(sys::Path(FileName));
+ PrintAndExit(ErrorInfo, M);
// Write it out
WriteBitcodeToFile(M, Out);
-
- // Close the bitcode file.
- Out.close();
}
/// GenerateAssembly - generates a native assembly language source file from the
@@ -408,7 +406,7 @@ static int GenerateNative(const std::string &OutputFilename,
/// EmitShellScript - Output the wrapper file that invokes the JIT on the LLVM
/// bitcode file for the program.
-static void EmitShellScript(char **argv) {
+static void EmitShellScript(char **argv, Module *M) {
if (Verbose)
outs() << "Emitting Shell Script\n";
#if defined(_WIN32) || defined(__CYGWIN__)
@@ -419,10 +417,10 @@ static void EmitShellScript(char **argv) {
sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0],
(void *)(intptr_t)&Optimize);
if (llvmstub.isEmpty())
- PrintAndExit("Could not find llvm-stub.exe executable!");
+ PrintAndExit("Could not find llvm-stub.exe executable!", M);
if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, M);
return;
#endif
@@ -431,7 +429,7 @@ static void EmitShellScript(char **argv) {
std::string ErrorInfo;
raw_fd_ostream Out2(OutputFilename.c_str(), ErrorInfo);
if (!ErrorInfo.empty())
- PrintAndExit(ErrorInfo);
+ PrintAndExit(ErrorInfo, M);
Out2 << "#!/bin/sh\n";
// Allow user to setenv LLVMINTERP if lli is not in their PATH.
@@ -470,7 +468,6 @@ static void EmitShellScript(char **argv) {
Out2 << " -load=" << FullLibraryPath.str() << " \\\n";
}
Out2 << " " << BitcodeOutputFilename << " ${1+\"$@\"}\n";
- Out2.close();
}
// BuildLinkItems -- This function generates a LinkItemList for the LinkItems
@@ -521,6 +518,39 @@ int main(int argc, char **argv, char **envp) {
// Parse the command line options
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
+#if defined(_WIN32) || defined(__CYGWIN__)
+ if (!LinkAsLibrary) {
+ // Default to "a.exe" instead of "a.out".
+ if (OutputFilename.getNumOccurrences() == 0)
+ OutputFilename = "a.exe";
+
+ // If there is no suffix add an "exe" one.
+ sys::Path ExeFile( OutputFilename );
+ if (ExeFile.getSuffix() == "") {
+ ExeFile.appendSuffix("exe");
+ OutputFilename = ExeFile.str();
+ }
+ }
+#endif
+
+ // Generate the bitcode for the optimized module.
+ // If -b wasn't specified, use the name specified
+ // with -o to construct BitcodeOutputFilename.
+ if (BitcodeOutputFilename.empty()) {
+ BitcodeOutputFilename = OutputFilename;
+ if (!LinkAsLibrary) BitcodeOutputFilename += ".bc";
+ }
+
+ // Arrange for the bitcode output file to be deleted on any errors.
+ BitcodeOutputRemover.setFile(sys::Path(BitcodeOutputFilename));
+ sys::RemoveFileOnSignal(sys::Path(BitcodeOutputFilename));
+
+ // Arrange for the output file to be deleted on any errors.
+ if (!LinkAsLibrary) {
+ OutputRemover.setFile(sys::Path(OutputFilename));
+ sys::RemoveFileOnSignal(sys::Path(OutputFilename));
+ }
+
// Construct a Linker (now that Verbose is set)
Linker TheLinker(progname, OutputFilename, Context, Verbose);
@@ -563,29 +593,7 @@ int main(int argc, char **argv, char **envp) {
// Optimize the module
Optimize(Composite.get());
-#if defined(_WIN32) || defined(__CYGWIN__)
- if (!LinkAsLibrary) {
- // Default to "a.exe" instead of "a.out".
- if (OutputFilename.getNumOccurrences() == 0)
- OutputFilename = "a.exe";
-
- // If there is no suffix add an "exe" one.
- sys::Path ExeFile( OutputFilename );
- if (ExeFile.getSuffix() == "") {
- ExeFile.appendSuffix("exe");
- OutputFilename = ExeFile.str();
- }
- }
-#endif
-
- // Generate the bitcode for the optimized module.
- // If -b wasn't specified, use the name specified
- // with -o to construct BitcodeOutputFilename.
- if (BitcodeOutputFilename.empty()) {
- BitcodeOutputFilename = OutputFilename;
- if (!LinkAsLibrary) BitcodeOutputFilename += ".bc";
- }
-
+ // Generate the bitcode output.
GenerateBitcode(Composite.get(), BitcodeOutputFilename);
// If we are not linking a library, generate either a native executable
@@ -601,13 +609,13 @@ int main(int argc, char **argv, char **envp) {
prog = sys::Program::FindProgramByName(*I);
if (prog.isEmpty())
PrintAndExit(std::string("Optimization program '") + *I +
- "' is not found or not executable.");
+ "' is not found or not executable.", Composite.get());
}
// Get the program arguments
sys::Path tmp_output("opt_result");
std::string ErrMsg;
if (tmp_output.createTemporaryFileOnDisk(true, &ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
const char* args[4];
args[0] = I->c_str();
@@ -615,15 +623,16 @@ int main(int argc, char **argv, char **envp) {
args[2] = tmp_output.c_str();
args[3] = 0;
if (0 == sys::Program::ExecuteAndWait(prog, args, 0,0,0,0, &ErrMsg)) {
- if (tmp_output.isBitcodeFile() || tmp_output.isBitcodeFile()) {
+ if (tmp_output.isBitcodeFile()) {
sys::Path target(BitcodeOutputFilename);
target.eraseFromDisk();
if (tmp_output.renamePathOnDisk(target, &ErrMsg))
- PrintAndExit(ErrMsg, 2);
+ PrintAndExit(ErrMsg, Composite.get(), 2);
} else
- PrintAndExit("Post-link optimization output is not bitcode");
+ PrintAndExit("Post-link optimization output is not bitcode",
+ Composite.get());
} else {
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
}
}
}
@@ -637,79 +646,77 @@ int main(int argc, char **argv, char **envp) {
sys::Path AssemblyFile ( OutputFilename);
AssemblyFile.appendSuffix("s");
- // Mark the output files for removal if we get an interrupt.
+ // Mark the output files for removal.
+ FileRemover AssemblyFileRemover(AssemblyFile);
sys::RemoveFileOnSignal(AssemblyFile);
- sys::RemoveFileOnSignal(sys::Path(OutputFilename));
// Determine the locations of the llc and gcc programs.
sys::Path llc = FindExecutable("llc", argv[0],
(void *)(intptr_t)&Optimize);
if (llc.isEmpty())
- PrintAndExit("Failed to find llc");
+ PrintAndExit("Failed to find llc", Composite.get());
sys::Path gcc = sys::Program::FindProgramByName("gcc");
if (gcc.isEmpty())
- PrintAndExit("Failed to find gcc");
+ PrintAndExit("Failed to find gcc", Composite.get());
// Generate an assembly language file for the bitcode.
std::string ErrMsg;
if (0 != GenerateAssembly(AssemblyFile.str(), BitcodeOutputFilename,
llc, ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
if (0 != GenerateNative(OutputFilename, AssemblyFile.str(),
NativeLinkItems, gcc, envp, ErrMsg))
- PrintAndExit(ErrMsg);
-
- // Remove the assembly language file.
- AssemblyFile.eraseFromDisk();
+ PrintAndExit(ErrMsg, Composite.get());
} else if (NativeCBE) {
sys::Path CFile (OutputFilename);
CFile.appendSuffix("cbe.c");
- // Mark the output files for removal if we get an interrupt.
+ // Mark the output files for removal.
+ FileRemover CFileRemover(CFile);
sys::RemoveFileOnSignal(CFile);
- sys::RemoveFileOnSignal(sys::Path(OutputFilename));
// Determine the locations of the llc and gcc programs.
sys::Path llc = FindExecutable("llc", argv[0],
(void *)(intptr_t)&Optimize);
if (llc.isEmpty())
- PrintAndExit("Failed to find llc");
+ PrintAndExit("Failed to find llc", Composite.get());
sys::Path gcc = sys::Program::FindProgramByName("gcc");
if (gcc.isEmpty())
- PrintAndExit("Failed to find gcc");
+ PrintAndExit("Failed to find gcc", Composite.get());
// Generate an assembly language file for the bitcode.
std::string ErrMsg;
if (GenerateCFile(CFile.str(), BitcodeOutputFilename, llc, ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
if (GenerateNative(OutputFilename, CFile.str(),
NativeLinkItems, gcc, envp, ErrMsg))
- PrintAndExit(ErrMsg);
-
- // Remove the assembly language file.
- CFile.eraseFromDisk();
-
+ PrintAndExit(ErrMsg, Composite.get());
} else {
- EmitShellScript(argv);
+ EmitShellScript(argv, Composite.get());
}
// Make the script executable...
std::string ErrMsg;
if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
// Make the bitcode file readable and directly executable in LLEE as well
if (sys::Path(BitcodeOutputFilename).makeExecutableOnDisk(&ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
if (sys::Path(BitcodeOutputFilename).makeReadableOnDisk(&ErrMsg))
- PrintAndExit(ErrMsg);
+ PrintAndExit(ErrMsg, Composite.get());
}
+ // Operations which may fail are now complete.
+ BitcodeOutputRemover.releaseFile();
+ if (!LinkAsLibrary)
+ OutputRemover.releaseFile();
+
// Graceful exit
return 0;
}
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index fae4d10..c60e56a 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -19,7 +19,6 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SystemUtils.h"
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 3c23990..6dce5cc 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -55,7 +55,11 @@ static cl::opt<unsigned>
OutputAsmVariant("output-asm-variant",
cl::desc("Syntax variant to use for output printing"));
+static cl::opt<bool>
+RelaxAll("mc-relax-all", cl::desc("Relax all fixups"));
+
enum OutputFileType {
+ OFT_Null,
OFT_AssemblyFile,
OFT_ObjectFile
};
@@ -65,6 +69,8 @@ FileType("filetype", cl::init(OFT_AssemblyFile),
cl::values(
clEnumValN(OFT_AssemblyFile, "asm",
"Emit an assembly ('.s') file"),
+ clEnumValN(OFT_Null, "null",
+ "Don't emit anything (for timing purposes)"),
clEnumValN(OFT_ObjectFile, "obj",
"Emit a native object ('.o') file"),
clEnumValEnd));
@@ -289,11 +295,13 @@ static int AssembleInput(const char *ProgName) {
CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
Str.reset(createAsmStreamer(Ctx, *Out,TM->getTargetData()->isLittleEndian(),
/*asmverbose*/true, IP, CE.get(), ShowInst));
+ } else if (FileType == OFT_Null) {
+ Str.reset(createNullStreamer(Ctx));
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
TAB.reset(TheTarget->createAsmBackend(TripleName));
- Str.reset(createMachOStreamer(Ctx, *TAB, *Out, CE.get()));
+ Str.reset(createMachOStreamer(Ctx, *TAB, *Out, CE.get(), RelaxAll));
}
AsmParser Parser(SrcMgr, Ctx, *Str.get(), *MAI);
diff --git a/tools/llvmc/plugins/Base/Base.td.in b/tools/llvmc/plugins/Base/Base.td.in
index ac0f665..3ad07c0 100644
--- a/tools/llvmc/plugins/Base/Base.td.in
+++ b/tools/llvmc/plugins/Base/Base.td.in
@@ -233,6 +233,8 @@ def llvm_gcc_assembler : Tool<
(switch_on "c"), (stop_compilation),
(not_empty "arch"), (forward "arch"),
(not_empty "Xassembler"), (forward "Xassembler"),
+ (switch_on "m32"), (forward "m32"),
+ (switch_on "m64"), (forward "m64"),
(not_empty "Wa,"), (forward "Wa,")))
]>;
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index 15753d3..bc65b3a 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -24,8 +24,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/LoopPass.h"
-#include "llvm/Analysis/Verifier.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -36,8 +34,6 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/IPO.h"
-#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MemoryBuffer.h"
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index b123d54..311f671 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -28,7 +28,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/IRReader.h"
#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/StandardPasses.h"
@@ -424,9 +423,9 @@ int main(int argc, char **argv) {
if (TD)
Passes.add(TD);
- FunctionPassManager *FPasses = NULL;
+ OwningPtr<FunctionPassManager> FPasses;
if (OptLevelO1 || OptLevelO2 || OptLevelO3) {
- FPasses = new FunctionPassManager(M.get());
+ FPasses.reset(new FunctionPassManager(M.get()));
if (TD)
FPasses->add(new TargetData(*TD));
}
OpenPOWER on IntegriCloud