gollvm: sync with llvm trunks and update llvm repository
LLVM trunk 1b2842bf902a CreateMemSet use MaybeAlign.
LLVM trunk 1dfede3122ee move CodeGenFileType enum to Support/CodeGen.h.
Add a few missing included header files to Gollvm:
1, Add header file "llvm/Support/CommandLine.h" to file passes/GC.cpp.
2, Add header file "llvm/InitializePasses.h" to files passes/GoNilChecks.cpp and
passes/GoStatepoints.cpp.
LLVM project is moving to Github, the LLVM sub-project repository
"http://llvm.org/git/llvm.git" is now not maintained, and we can't download the
latest LLVM code from it, see https://llvm.org/docs/Proposals/GitHubMove.html.
So this CL updates the README document.
In addition, CL 210323 introduces a build error: on a platform that does not
support "-fsplit-stack", cmake will still report an error message even if
GOLLVM_USE_SPLIT_STACK is turned off. This CL also fixed the error.
Change-Id: Idbcd60264936eeffc6da17de9a6a1bd10a7b0dfe
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/212057
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/README.md b/README.md
index e3a6bfa..86bbe8a 100644
--- a/README.md
+++ b/README.md
@@ -47,9 +47,9 @@
% cd workarea
// Sources
-% git clone http://llvm.org/git/llvm.git
+% git clone https://github.com/llvm/llvm-project.git
...
-% cd llvm/tools
+% cd llvm-project/llvm/tools
% git clone https://go.googlesource.com/gollvm
...
% cd gollvm
@@ -73,7 +73,7 @@
% cd workarea
% mkdir build-debug
% cd build-debug
-% cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm
+% cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm
...
% ninja gollvm
...
@@ -91,7 +91,7 @@
```
% mkdir build.rel
% cd build.rel
-% cmake -DCMAKE_INSTALL_PREFIX=/my/install/dir -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -G Ninja ../llvm
+% cmake -DCMAKE_INSTALL_PREFIX=/my/install/dir -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm
// Build all of gollvm
% ninja gollvm
diff --git a/cmake/modules/ConfigSetup.cmake b/cmake/modules/ConfigSetup.cmake
index dc271ed..f0a0e41 100644
--- a/cmake/modules/ConfigSetup.cmake
+++ b/cmake/modules/ConfigSetup.cmake
@@ -136,9 +136,7 @@
# Issue an error if the C compiler doesn't support -fsplit-stack
# (in theory you can build libgo without it, so I suppose this could
# be changed to a warning).
-if(NOT C_SUPPORTS_SPLIT_STACK)
- message(SEND_ERROR "C compiler does not support -fsplit-stack")
-else()
+if(C_SUPPORTS_SPLIT_STACK)
set(USING_SPLIT_STACK 1)
endif()
set(USE_LIBFFI 1)
diff --git a/driver/CompileGo.cpp b/driver/CompileGo.cpp
index 4d04c31..5c64b4b 100644
--- a/driver/CompileGo.cpp
+++ b/driver/CompileGo.cpp
@@ -929,7 +929,7 @@
legacy::PassManager codeGenPasses;
bool noverify = args_.hasArg(gollvm::options::OPT_noverify);
- TargetMachine::CodeGenFileType ft = TargetMachine::CGFT_AssemblyFile;
+ CodeGenFileType ft = CGFT_AssemblyFile;
// Add passes to emit bitcode or LLVM IR as appropriate. Here we mimic
// clang behavior, which is to emit bitcode when "-emit-llvm" is specified
diff --git a/passes/GC.cpp b/passes/GC.cpp
index cba387d..adc7cbb 100644
--- a/passes/GC.cpp
+++ b/passes/GC.cpp
@@ -24,6 +24,7 @@
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
#include <vector>
using namespace llvm;
diff --git a/passes/GoNilChecks.cpp b/passes/GoNilChecks.cpp
index 955366f..753db33 100644
--- a/passes/GoNilChecks.cpp
+++ b/passes/GoNilChecks.cpp
@@ -53,6 +53,7 @@
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Pass.h"
+#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include <cassert>
#include <cstdint>
diff --git a/passes/GoStatepoints.cpp b/passes/GoStatepoints.cpp
index bc3d81c..a6801ba 100644
--- a/passes/GoStatepoints.cpp
+++ b/passes/GoStatepoints.cpp
@@ -59,6 +59,7 @@
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
+#include "llvm/InitializePasses.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
@@ -1701,7 +1702,7 @@
IRBuilder<> Builder(&I);
Value *Zero = Constant::getNullValue(Int8Ty);
Value *Siz = I.getOperand(0);
- Builder.CreateMemSet(V, Zero, Siz, 0);
+ Builder.CreateMemSet(V, Zero, Siz, MaybeAlign(0));
}
InstToDelete.push_back(&I);
}
@@ -2913,7 +2914,7 @@
for (Value *Alloca : ToClobber) {
unsigned Siz =
DL.getTypeStoreSize(Alloca->getType()->getPointerElementType());
- Builder.CreateMemSet(Alloca, Bad, Siz, 0);
+ Builder.CreateMemSet(Alloca, Bad, Siz, MaybeAlign(0));
//dbgs() << "clobber " << *Alloca << " at " << *Inst << "\n";
}
}