Skip to content

Commit e3b1f3c

Browse files
committed
auto merge of #11853 : alexcrichton/rust/up-llvm, r=brson
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!
2 parents 056363f + 8cd935f commit e3b1f3c

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
@@ -1768,6 +1768,8 @@ pub mod llvm {
17681768
pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *c_char,
17691769
out_len: *mut size_t) -> *c_char;
17701770
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1771+
1772+
pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
17711773
}
17721774
}
17731775

src/librustc/middle/trans/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2523,12 +2523,12 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
25232523
llvm::LLVMAddGlobal(llmod, maptype.to_ref(), buf)
25242524
}
25252525
});
2526+
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
2527+
25262528
// On windows we'd like to export the toplevel cratemap
25272529
// such that we can find it from libstd.
25282530
if targ_cfg.os == OsWin32 && is_top {
2529-
lib::llvm::SetLinkage(map, lib::llvm::DLLExportLinkage);
2530-
} else {
2531-
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
2531+
unsafe { llvm::LLVMRustSetDLLExportStorageClass(map) }
25322532
}
25332533

25342534
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
@@ -186,7 +186,7 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
186186
std::string ErrorInfo;
187187
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_Binary);
188188
formatted_raw_ostream FOS(OS);
189-
PM->add(createPrintModulePass(&FOS));
189+
PM->add(createPrintModulePass(FOS));
190190
PM->run(*unwrap(M));
191191
}
192192

src/rustllvm/RustWrapper.cpp

+13-7
Original file line numberDiff line numberDiff line change
@@ -545,15 +545,15 @@ extern "C" bool
545545
LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
546546
Module *Dst = unwrap(dst);
547547
MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
548-
std::string Err;
549-
Module *Src = llvm::getLazyBitcodeModule(buf, Dst->getContext(), &Err);
550-
if (Src == NULL) {
551-
LLVMRustError = Err.c_str();
548+
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext());
549+
if (!Src) {
550+
LLVMRustError = Src.getError().message().c_str();
552551
delete buf;
553552
return false;
554553
}
555554

556-
if (Linker::LinkModules(Dst, Src, Linker::DestroySource, &Err)) {
555+
std::string Err;
556+
if (Linker::LinkModules(Dst, *Src, Linker::DestroySource, &Err)) {
557557
LLVMRustError = Err.c_str();
558558
return false;
559559
}
@@ -578,8 +578,8 @@ LLVMRustOpenArchive(char *path) {
578578

579579
extern "C" const char*
580580
LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
581-
for (Archive::child_iterator child = ar->begin_children(),
582-
end = ar->end_children();
581+
for (Archive::child_iterator child = ar->child_begin(),
582+
end = ar->child_end();
583583
child != end; ++child) {
584584
StringRef sect_name;
585585
error_code err = child->getName(sect_name);
@@ -597,3 +597,9 @@ extern "C" void
597597
LLVMRustDestroyArchive(Archive *ar) {
598598
delete ar;
599599
}
600+
601+
extern "C" void
602+
LLVMRustSetDLLExportStorageClass(LLVMValueRef Value) {
603+
GlobalValue *V = unwrap<GlobalValue>(Value);
604+
V->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
605+
}

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)