Update to llvm-5.0.1rc2.

from Brad (maintainer)
This commit is contained in:
ajacoutot 2017-12-03 10:19:37 +00:00
parent 591500b573
commit 1cbe63224f
10 changed files with 19 additions and 259 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.167 2017/12/01 08:00:20 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.168 2017/12/03 10:19:37 ajacoutot Exp $
# XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when
# updating this port.
@ -13,17 +13,16 @@ MULTI_PACKAGES = -main -python
COMMENT-main = modular, fast C/C++/ObjC compiler, static analyzer and tools
COMMENT-python = Python bindings for Clang
LLVM_V = 5.0.0
LLVM_V = 5.0.1rc2
DISTNAME = llvm-${LLVM_V}.src
PKGNAME = llvm-${LLVM_V}
PKGNAME-main = llvm-${LLVM_V}
PKGNAME-python = py-llvm-${LLVM_V}
REVISION-main = 10
CATEGORIES = devel
DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \
cfe-${LLVM_V}.src${EXTRACT_SUFX} \
lld-${LLVM_V}.src${EXTRACT_SUFX}
MASTER_SITES = https://www.llvm.org/releases/${LLVM_V}/
MASTER_SITES = http://prereleases.llvm.org/5.0.1/rc2/
EXTRACT_SUFX = .tar.xz
SHARED_LIBS = clang 6.0 \
@ -85,7 +84,7 @@ GCC_CONFIG = x86_64-unknown-openbsd${OSREV}
.else
GCC_CONFIG = ${MACHINE_ARCH}-unknown-openbsd${OSREV}
.endif
CLANG_INCLUDE_PATH = lib/clang/${LLVM_V}/include
CLANG_INCLUDE_PATH = lib/clang/${LLVM_V:S/rc2//}/include
SUBST_VARS += CLANG_INCLUDE_PATH LLVM_V GCC_VER GCC_CONFIG
post-extract:

View File

@ -1,6 +1,6 @@
SHA256 (cfe-5.0.0.src.tar.xz) = AZ8jwhkt95OsdGWV6UpAOQh0n44MSEtANHbSYR3SCXA=
SHA256 (lld-5.0.0.src.tar.xz) = OZp5IKUnjULEanv35BkYIOwjAUV6fQ1PzJpKwF3VOJc=
SHA256 (llvm-5.0.0.src.tar.xz) = 413LrmCErc9KuzJRQSfF6r19Y7czhSzNsx4G8TcxNto=
SIZE (cfe-5.0.0.src.tar.xz) = 11437024
SIZE (lld-5.0.0.src.tar.xz) = 668344
SIZE (llvm-5.0.0.src.tar.xz) = 23411980
SHA256 (cfe-5.0.1rc2.src.tar.xz) = bQ3bGlHF9Th9Xha8iWPgDQ8H9Dw0Z7u/hac6+ihQzLk=
SHA256 (lld-5.0.1rc2.src.tar.xz) = XeLQDzljOiO6vnLlIktGnyBErDABq2FOjz3iFSVcZAE=
SHA256 (llvm-5.0.1rc2.src.tar.xz) = wt6EFCb6CrAZCf0B7scoaChGTLf+rOvHEFqrR+PwQqo=
SIZE (cfe-5.0.1rc2.src.tar.xz) = 11512960
SIZE (lld-5.0.1rc2.src.tar.xz) = 668368
SIZE (llvm-5.0.1rc2.src.tar.xz) = 23508164

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-lib_CodeGen_AsmPrinter_DwarfExpression_cpp,v 1.1 2017/09/14 06:10:11 ajacoutot Exp $
Fix a logic error in DwarfExpression::addMachineReg()
This fixes PR34323 and thus splitting undescribable registers into
smaller, describable sub-registers.
Index: lib/CodeGen/AsmPrinter/DwarfExpression.cpp
--- lib/CodeGen/AsmPrinter/DwarfExpression.cpp.orig
+++ lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -131,13 +131,12 @@ bool DwarfExpression::addMachineReg(const TargetRegist
// Intersection between the bits we already emitted and the bits
// covered by this subregister.
- SmallBitVector Intersection(RegSize, false);
- Intersection.set(Offset, Offset + Size);
- Intersection ^= Coverage;
+ SmallBitVector CurSubReg(RegSize, false);
+ CurSubReg.set(Offset, Offset + Size);
// If this sub-register has a DWARF number and we haven't covered
// its range, emit a DWARF piece for it.
- if (Reg >= 0 && Intersection.any()) {
+ if (Reg >= 0 && CurSubReg.test(Coverage)) {
// Emit a piece for any gap in the coverage.
if (Offset > CurPos)
DwarfRegs.push_back({-1, Offset - CurPos, nullptr});

View File

@ -1,47 +1,13 @@
$OpenBSD: patch-lib_Target_AArch64_AArch64ISelLowering_cpp,v 1.5 2017/09/25 10:44:19 ajacoutot Exp $
$OpenBSD: patch-lib_Target_AArch64_AArch64ISelLowering_cpp,v 1.6 2017/12/03 10:19:37 ajacoutot Exp $
- [AArch64] Fix bug in store of vector 0 DAGCombine.
Avoid using XZR/WZR directly as operands to split stores of zero
vectors. Doing so can lead to the XZR/WZR being used by an instruction
that doesn't allow it (e.g. add).
Fixes bug 34674.
- Disable the Load Stack Guard for OpenBSD on AArch64. We don't use it
on any other platform and it causes a segfault in combination with our
IR Stack Guard.
Disable the Load Stack Guard for OpenBSD on AArch64. We don't use it
on any other platform and it causes a segfault in combination with our
IR Stack Guard.
Index: lib/Target/AArch64/AArch64ISelLowering.cpp
--- lib/Target/AArch64/AArch64ISelLowering.cpp.orig
+++ lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -9347,11 +9347,20 @@ static SDValue replaceZeroVectorStore(SelectionDAG &DA
return SDValue();
}
- // Use WZR/XZR here to prevent DAGCombiner::MergeConsecutiveStores from
- // undoing this transformation.
- SDValue SplatVal = VT.getVectorElementType().getSizeInBits() == 32
- ? DAG.getRegister(AArch64::WZR, MVT::i32)
- : DAG.getRegister(AArch64::XZR, MVT::i64);
+ // Use a CopyFromReg WZR/XZR here to prevent
+ // DAGCombiner::MergeConsecutiveStores from undoing this transformation.
+ SDLoc DL(&St);
+ unsigned ZeroReg;
+ EVT ZeroVT;
+ if (VT.getVectorElementType().getSizeInBits() == 32) {
+ ZeroReg = AArch64::WZR;
+ ZeroVT = MVT::i32;
+ } else {
+ ZeroReg = AArch64::XZR;
+ ZeroVT = MVT::i64;
+ }
+ SDValue SplatVal =
+ DAG.getCopyFromReg(DAG.getEntryNode(), DL, ZeroReg, ZeroVT);
return splitStoreSplat(DAG, St, SplatVal, NumVecElts);
}
@@ -10568,7 +10577,8 @@ void AArch64TargetLowering::ReplaceNodeResults(
@@ -10577,7 +10577,8 @@ void AArch64TargetLowering::ReplaceNodeResults(
}
bool AArch64TargetLowering::useLoadStackGuardNode() const {

View File

@ -1,41 +0,0 @@
$OpenBSD: patch-lib_Target_X86_X86ISelLowering_cpp,v 1.4 2017/09/16 07:01:33 ajacoutot Exp $
[X86] Don't create i64 constants on 32-bit targets when lowering v64i1 constant build
vectors
When handling a v64i1 build vector of constants on 32-bit targets we were creating an
illegal i64 constant that we then bitcasted back to v64i1. We need to instead create
two 32-bit constants, bitcast them to v32i1 and concat the result. We should also
take care to handle the halves being all zeros/ones after the split.
This patch splits the build vector and then recursively lowers the two pieces. This
allows us to handle the all ones and all zeros cases with minimal effort. Ideally
we'd just do the split and concat, and let lowering get called again on the new
nodes, but getNode has special handling for CONCAT_VECTORS that reassembles the
pieces back into a single BUILD_VECTOR. Hopefully the two temporary BUILD_VECTORS we
had to create to do this that don't get returned don't cause any issues.
Fixes PR34605.
Index: lib/Target/X86/X86ISelLowering.cpp
--- lib/Target/X86/X86ISelLowering.cpp.orig
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -7026,6 +7026,18 @@ X86TargetLowering::LowerBUILD_VECTORvXi1(SDValue Op, S
return DAG.getTargetConstant(1, dl, VT);
if (ISD::isBuildVectorOfConstantSDNodes(Op.getNode())) {
+ if (VT == MVT::v64i1 && !Subtarget.is64Bit()) {
+ // Split the pieces.
+ SDValue Lower =
+ DAG.getBuildVector(MVT::v32i1, dl, Op.getNode()->ops().slice(0, 32));
+ SDValue Upper =
+ DAG.getBuildVector(MVT::v32i1, dl, Op.getNode()->ops().slice(32, 32));
+ // We have to manually lower both halves so getNode doesn't try to
+ // reassemble the build_vector.
+ Lower = LowerBUILD_VECTORvXi1(Lower, DAG);
+ Upper = LowerBUILD_VECTORvXi1(Upper, DAG);
+ return DAG.getNode(ISD::CONCAT_VECTORS, dl, MVT::v64i1, Lower, Upper);
+ }
SDValue Imm = ConvertI1VectorToInteger(Op, DAG);
if (Imm.getValueSizeInBits() == VT.getSizeInBits())
return DAG.getBitcast(VT, Imm);

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-tools_clang_include_clang_Basic_BuiltinsX86_def,v 1.1 2017/10/07 12:08:33 ajacoutot Exp $
[X86] Disable _mm512_maskz_set1_epi64 intrinsic on 32-bit targets to prevent a
backend isel failure.
The __builtin_ia32_pbroadcastq512_mem_mask we were previously trying to use in
32-bit mode is not implemented in the x86 backend and causes isel to fail in
release builds. In debug builds it fails even earlier during legalization with
an llvm_unreachable.
Index: tools/clang/include/clang/Basic/BuiltinsX86.def
--- tools/clang/include/clang/Basic/BuiltinsX86.def.orig
+++ tools/clang/include/clang/Basic/BuiltinsX86.def
@@ -976,7 +976,6 @@ TARGET_BUILTIN(__builtin_ia32_pmuludq512, "V8LLiV16iV1
TARGET_BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "", "avx512f")
TARGET_BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "", "avx512f")
TARGET_BUILTIN(__builtin_ia32_pbroadcastd512_gpr_mask, "V16iiV16iUs", "", "avx512f")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq512_mem_mask, "V8LLiLLiV8LLiUc", "", "avx512f")
TARGET_BUILTIN(__builtin_ia32_loaddqusi512_mask, "V16iiC*V16iUs", "", "avx512f")
TARGET_BUILTIN(__builtin_ia32_loaddqudi512_mask, "V8LLiLLiC*V8LLiUc", "", "avx512f")
TARGET_BUILTIN(__builtin_ia32_loadups512_mask, "V16ffC*V16fUs", "", "avx512f")

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Clang_cpp,v 1.2 2017/09/08 05:58:19 ajacoutot Exp $
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Clang_cpp,v 1.3 2017/12/03 10:19:37 ajacoutot Exp $
- Make LLVM create strict aligned code for OpenBSD/arm64.
- Disable -fstrict-aliasing per default on OpenBSD.
@ -21,7 +21,7 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
@@ -2304,9 +2304,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
@@ -2308,9 +2308,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
OFastEnabled ? options::OPT_Ofast : options::OPT_fstrict_aliasing;
// We turn strict aliasing off by default if we're in CL mode, since MSVC
// doesn't do any TBAA.
@ -36,7 +36,7 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
CmdArgs.push_back("-relaxed-aliasing");
if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
options::OPT_fno_struct_path_tbaa))
@@ -3292,7 +3295,8 @@ void Clang::ConstructJob(Compilation &C, const JobActi
@@ -3296,7 +3299,8 @@ void Clang::ConstructJob(Compilation &C, const JobActi
options::OPT_fno_strict_overflow)) {
if (A->getOption().matches(options::OPT_fno_strict_overflow))
CmdArgs.push_back("-fwrapv");
@ -46,7 +46,7 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
options::OPT_fno_reroll_loops))
@@ -4228,6 +4232,18 @@ void Clang::ConstructJob(Compilation &C, const JobActi
@@ -4232,6 +4236,18 @@ void Clang::ConstructJob(Compilation &C, const JobActi
CmdArgs.push_back("-fno-builtin-strcpy");
}
#endif

View File

@ -1,37 +0,0 @@
$OpenBSD: patch-tools_clang_lib_Headers_avx512fintrin_h,v 1.1 2017/10/07 12:08:33 ajacoutot Exp $
[X86] Disable _mm512_maskz_set1_epi64 intrinsic on 32-bit targets to prevent a
backend isel failure.
The __builtin_ia32_pbroadcastq512_mem_mask we were previously trying to use in
32-bit mode is not implemented in the x86 backend and causes isel to fail in
release builds. In debug builds it fails even earlier during legalization with
an llvm_unreachable.
Index: tools/clang/lib/Headers/avx512fintrin.h
--- tools/clang/lib/Headers/avx512fintrin.h.orig
+++ tools/clang/lib/Headers/avx512fintrin.h
@@ -267,21 +267,16 @@ _mm512_maskz_set1_epi32(__mmask16 __M, int __A)
__M);
}
+#ifdef __x86_64__
static __inline __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_set1_epi64(__mmask8 __M, long long __A)
{
-#ifdef __x86_64__
return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A,
(__v8di)
_mm512_setzero_si512 (),
__M);
-#else
- return (__m512i) __builtin_ia32_pbroadcastq512_mem_mask (__A,
- (__v8di)
- _mm512_setzero_si512 (),
- __M);
-#endif
}
+#endif
static __inline __m512 __DEFAULT_FN_ATTRS
_mm512_setzero_ps(void)

View File

@ -1,56 +0,0 @@
$OpenBSD: patch-tools_lld_ELF_SyntheticSections_cpp,v 1.4 2017/10/08 07:40:18 ajacoutot Exp $
- [ELF] - Fix segfault when processing .eh_frame.
Its a PR34648 which was a segfault that happened because
we stored pointers to elements in DenseMap.
When DenseMap grows such pointers are invalidated.
Solution implemented is to keep elements by pointer
and not by value.
- [LLD] Fix padding of .eh_frame when in executable segment
The default padding for an executable segment is the target trap
instruction which for x86_64 is 0xCC. However, the .eh_frame section
requires the padding to be zero. The code that writes the .eh_frame
section assumes that its segment is zero initialized and does not
explicitly write the zero padding. This does not work when the .eh_frame
section is in the executable segment (for example when using
-no-rosegment).
This patch changes the .eh_frame writing code to explicitly write the
zero padding.
Index: tools/lld/ELF/SyntheticSections.cpp
--- tools/lld/ELF/SyntheticSections.cpp.orig
+++ tools/lld/ELF/SyntheticSections.cpp
@@ -427,10 +427,11 @@ CieRecord *EhFrameSection<ELFT>::addCie(EhSectionPiece
&Sec->template getFile<ELFT>()->getRelocTargetSym(Rels[FirstRelI]);
// Search for an existing CIE by CIE contents/relocation target pair.
- CieRecord *Cie = &CieMap[{Piece.data(), Personality}];
+ CieRecord *&Cie = CieMap[{Piece.data(), Personality}];
// If not found, create a new one.
- if (Cie->Piece == nullptr) {
+ if (!Cie) {
+ Cie = make<CieRecord>();
Cie->Piece = &Piece;
Cies.push_back(Cie);
}
@@ -522,9 +523,14 @@ template <class ELFT>
static void writeCieFde(uint8_t *Buf, ArrayRef<uint8_t> D) {
memcpy(Buf, D.data(), D.size());
+ size_t Aligned = alignTo(D.size(), sizeof(typename ELFT::uint));
+
+ // Zero-clear trailing padding if it exists.
+ memset(Buf + D.size(), 0, Aligned - D.size());
+
// Fix the size field. -4 since size does not include the size field itself.
const endianness E = ELFT::TargetEndianness;
- write32<E>(Buf, alignTo(D.size(), sizeof(typename ELFT::uint)) - 4);
+ write32<E>(Buf, Aligned - 4);
}
template <class ELFT> void EhFrameSection<ELFT>::finalizeContents() {

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-tools_lld_ELF_SyntheticSections_h,v 1.1 2017/10/08 07:40:18 ajacoutot Exp $
[ELF] - Fix segfault when processing .eh_frame.
Its a PR34648 which was a segfault that happened because
we stored pointers to elements in DenseMap.
When DenseMap grows such pointers are invalidated.
Solution implemented is to keep elements by pointer
and not by value.
Index: tools/lld/ELF/SyntheticSections.h
--- tools/lld/ELF/SyntheticSections.h.orig
+++ tools/lld/ELF/SyntheticSections.h
@@ -103,7 +103,8 @@ template <class ELFT> class EhFrameSection final : pub
std::vector<CieRecord *> Cies;
// CIE records are uniquified by their contents and personality functions.
- llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord> CieMap;
+ llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord *>
+ CieMap;
};
class GotSection : public SyntheticSection {