Skip to content

Commit 8cd935f

Browse files
committed
Upgrade LLVM
This upgrade brings commit by @eddyb to help optimizations of virtual calls in a few places (llvm-mirror/llvm@6d2bd95) as well as a commit by @c-a to *greatly* improve the runtime of the optimization passes (rust-lang/llvm#3). Nice work to these guys!
1 parent d6d7812 commit 8cd935f

File tree

8 files changed

+26
-16
lines changed

8 files changed

+26
-16
lines changed

configure

+4
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,10 @@ do
916916
LLVM_OPTS="$LLVM_OPTS --disable-terminfo"
917917
# Try to have LLVM pull in as few dependencies as possible (#9397)
918918
LLVM_OPTS="$LLVM_OPTS --disable-zlib --disable-libffi"
919+
# LLVM says it needs a "new" clang/gcc, but we seem to get by ok with
920+
# older versions on the bots. Get by for a little longer by asking it to
921+
# not do version detection
922+
LLVM_OPTS="$LLVM_OPTS --disable-compiler-version-checks"
919923

920924
# Use win32 native thread/lock apis instead of pthread wrapper.
921925
# (llvm's configure tries to find pthread first, so we have to disable it explicitly.)

src/librustc/lib/llvm.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,8 @@ pub mod llvm {
17621762
pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *c_char,
17631763
out_len: *mut size_t) -> *c_char;
17641764
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1765+
1766+
pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
17651767
}
17661768
}
17671769

src/librustc/middle/trans/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2531,12 +2531,12 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
25312531
llvm::LLVMAddGlobal(llmod, maptype.to_ref(), buf)
25322532
}
25332533
});
2534+
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
2535+
25342536
// On windows we'd like to export the toplevel cratemap
25352537
// such that we can find it from libstd.
25362538
if targ_cfg.os == OsWin32 && is_top {
2537-
lib::llvm::SetLinkage(map, lib::llvm::DLLExportLinkage);
2538-
} else {
2539-
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
2539+
unsafe { llvm::LLVMRustSetDLLExportStorageClass(map) }
25402540
}
25412541

25422542
return (sym_name, map);

src/llvm

Submodule llvm updated 1406 files

src/rustllvm/PassWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
185185
std::string ErrorInfo;
186186
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_Binary);
187187
formatted_raw_ostream FOS(OS);
188-
PM->add(createPrintModulePass(&FOS));
188+
PM->add(createPrintModulePass(FOS));
189189
PM->run(*unwrap(M));
190190
}
191191

src/rustllvm/RustWrapper.cpp

+13-7
Original file line numberDiff line numberDiff line change
@@ -537,15 +537,15 @@ extern "C" bool
537537
LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
538538
Module *Dst = unwrap(dst);
539539
MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
540-
std::string Err;
541-
Module *Src = llvm::getLazyBitcodeModule(buf, Dst->getContext(), &Err);
542-
if (Src == NULL) {
543-
LLVMRustError = Err.c_str();
540+
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext());
541+
if (!Src) {
542+
LLVMRustError = Src.getError().message().c_str();
544543
delete buf;
545544
return false;
546545
}
547546

548-
if (Linker::LinkModules(Dst, Src, Linker::DestroySource, &Err)) {
547+
std::string Err;
548+
if (Linker::LinkModules(Dst, *Src, Linker::DestroySource, &Err)) {
549549
LLVMRustError = Err.c_str();
550550
return false;
551551
}
@@ -570,8 +570,8 @@ LLVMRustOpenArchive(char *path) {
570570

571571
extern "C" const char*
572572
LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
573-
for (Archive::child_iterator child = ar->begin_children(),
574-
end = ar->end_children();
573+
for (Archive::child_iterator child = ar->child_begin(),
574+
end = ar->child_end();
575575
child != end; ++child) {
576576
StringRef sect_name;
577577
error_code err = child->getName(sect_name);
@@ -589,3 +589,9 @@ extern "C" void
589589
LLVMRustDestroyArchive(Archive *ar) {
590590
delete ar;
591591
}
592+
593+
extern "C" void
594+
LLVMRustSetDLLExportStorageClass(LLVMValueRef Value) {
595+
GlobalValue *V = unwrap<GlobalValue>(Value);
596+
V->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
597+
}

src/rustllvm/llvm-auto-clean-trigger

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
22
# The actual contents of this file do not matter, but to trigger a change on the
33
# build bots then the contents should be changed so git updates the mtime.
4-
2014-01-22
4+
2014-01-27

src/rustllvm/rustllvm.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
#include "llvm/PassManager.h"
1717
#include "llvm/IR/InlineAsm.h"
1818
#include "llvm/IR/LLVMContext.h"
19-
#include "llvm/Analysis/Verifier.h"
19+
#include "llvm/IR/IRPrintingPasses.h"
2020
#include "llvm/Analysis/Passes.h"
2121
#include "llvm/Analysis/Lint.h"
2222
#include "llvm/ADT/ArrayRef.h"
2323
#include "llvm/ADT/Triple.h"
2424
#include "llvm/ADT/DenseSet.h"
25-
#include "llvm/Assembly/Parser.h"
26-
#include "llvm/Assembly/PrintModulePass.h"
2725
#include "llvm/Support/CommandLine.h"
2826
#include "llvm/Support/FormattedStream.h"
2927
#include "llvm/Support/Timer.h"

0 commit comments

Comments
 (0)