diff --git a/.gitignore b/.gitignore index cc0bf12..ae1a032 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/cfe-3.9.1.src.tar.xz +SOURCES/cfe-5.0.0.src.tar.xz SOURCES/cmake-3.4.3.tar.gz -SOURCES/llvm-3.9.1.src.tar.xz +SOURCES/llvm-5.0.0.src.tar.xz diff --git a/.llvm-private.metadata b/.llvm-private.metadata index c00ad8d..28739ee 100644 --- a/.llvm-private.metadata +++ b/.llvm-private.metadata @@ -1,3 +1,3 @@ -95e4be54b70f32cf98a8de36821ea5495b84add8 SOURCES/cfe-3.9.1.src.tar.xz +8c67071be174c66264b6c7629c291c0e30ecbdc5 SOURCES/cfe-5.0.0.src.tar.xz 49e4f05d46d4752e514b19ba36bf97d20a7da66a SOURCES/cmake-3.4.3.tar.gz -ce801cf456b8dacd565ce8df8288b4d90e7317ff SOURCES/llvm-3.9.1.src.tar.xz +7b0fd212ecc38461e392cbdcbe6a1d4944138a04 SOURCES/llvm-5.0.0.src.tar.xz diff --git a/SOURCES/0001-Fix-CMake-include-patch.patch b/SOURCES/0001-Fix-CMake-include-patch.patch new file mode 100644 index 0000000..ed60a3d --- /dev/null +++ b/SOURCES/0001-Fix-CMake-include-patch.patch @@ -0,0 +1,54 @@ +From f8dac15efe0c2330e1d24bcac89b1d01d9c794b9 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Mon, 2 Oct 2017 18:42:32 -0700 +Subject: [PATCH] Fix CMake include patch + +--- + CMakeLists.txt | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 160f3b0..2fd3a27 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -303,6 +303,7 @@ else() + endif() + + # Each of them corresponds to llvm-config's. ++# + set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir + set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) # --libdir + set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root +@@ -768,6 +769,11 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin ) + set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) + set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) + ++if(INCLUDE_INSTALL_DIR) ++else() ++set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include) ++endif() ++ + if(APPLE AND DARWIN_LTO_LIBRARY) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") +@@ -949,7 +955,7 @@ add_subdirectory(cmake/modules) + + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install(DIRECTORY include/llvm include/llvm-c +- DESTINATION include ++ DESTINATION "${INCLUDE_INSTALL_DIR}" + COMPONENT llvm-headers + FILES_MATCHING + PATTERN "*.def" +@@ -961,7 +967,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + ) + + install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm +- DESTINATION include ++ DESTINATION "${INCLUDE_INSTALL_DIR}" + COMPONENT llvm-headers + FILES_MATCHING + PATTERN "*.def" +-- +1.8.3.1 + diff --git a/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch b/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch new file mode 100644 index 0000000..2fae157 --- /dev/null +++ b/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch @@ -0,0 +1,79 @@ +From a481ab548d038c1dfd52ee211b997e2dd33ff5ae Mon Sep 17 00:00:00 2001 +From: Hal Finkel +Date: Wed, 6 Sep 2017 03:08:26 +0000 +Subject: [PATCH] [PowerPC] Don't use xscvdpspn on the P7 + +xscvdpspn was not introduced until the P8, so don't use it on the P7. Fixes a +regression introduced in r288152. + +git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312612 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + lib/Target/PowerPC/PPCISelLowering.cpp | 9 ++++++--- + test/CodeGen/PowerPC/fp-splat.ll | 27 +++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 3 deletions(-) + create mode 100644 test/CodeGen/PowerPC/fp-splat.ll + +diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp +index 74dedaf..6295693 100644 +--- a/lib/Target/PowerPC/PPCISelLowering.cpp ++++ b/lib/Target/PowerPC/PPCISelLowering.cpp +@@ -7463,9 +7463,11 @@ static SDValue BuildVSLDOI(SDValue LHS, SDValue RHS, unsigned Amt, EVT VT, + /// - The node is a "load-and-splat" + /// In all other cases, we will choose to keep the BUILD_VECTOR. + static bool haveEfficientBuildVectorPattern(BuildVectorSDNode *V, +- bool HasDirectMove) { ++ bool HasDirectMove, ++ bool HasP8Vector) { + EVT VecVT = V->getValueType(0); +- bool RightType = VecVT == MVT::v2f64 || VecVT == MVT::v4f32 || ++ bool RightType = VecVT == MVT::v2f64 || ++ (HasP8Vector && VecVT == MVT::v4f32) || + (HasDirectMove && (VecVT == MVT::v2i64 || VecVT == MVT::v4i32)); + if (!RightType) + return false; +@@ -7627,7 +7629,8 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op, + // lowered to VSX instructions under certain conditions. + // Without VSX, there is no pattern more efficient than expanding the node. + if (Subtarget.hasVSX() && +- haveEfficientBuildVectorPattern(BVN, Subtarget.hasDirectMove())) ++ haveEfficientBuildVectorPattern(BVN, Subtarget.hasDirectMove(), ++ Subtarget.hasP8Vector())) + return Op; + return SDValue(); + } +diff --git a/test/CodeGen/PowerPC/fp-splat.ll b/test/CodeGen/PowerPC/fp-splat.ll +new file mode 100644 +index 0000000..9b1ab21 +--- /dev/null ++++ b/test/CodeGen/PowerPC/fp-splat.ll +@@ -0,0 +1,27 @@ ++; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-P8 -check-prefix=CHECK ++; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-P7 -check-prefix=CHECK ++ ++define <4 x float> @test1(float %a) { ++entry: ++; CHECK-LABEL: test1 ++ %vecins = insertelement <4 x float> undef, float %a, i32 0 ++ %vecins1 = insertelement <4 x float> %vecins, float %a, i32 1 ++ %vecins2 = insertelement <4 x float> %vecins1, float %a, i32 2 ++ %vecins3 = insertelement <4 x float> %vecins2, float %a, i32 3 ++ ret <4 x float> %vecins3 ++; CHECK-P8: xscvdpspn ++; CHECK-P7-NOT: xscvdpspn ++; CHECK: blr ++} ++ ++define <2 x double> @test2(double %a) { ++entry: ++; CHECK-LABEL: test2 ++ %vecins = insertelement <2 x double> undef, double %a, i32 0 ++ %vecins1 = insertelement <2 x double> %vecins, double %a, i32 1 ++ ret <2 x double> %vecins1 ++; CHECK-P8: xxspltd ++; CHECK-P7: xxspltd ++; CHECK: blr ++} ++ +-- +1.8.3.1 + diff --git a/SOURCES/clang-hardcode-have-zlib.patch b/SOURCES/clang-hardcode-have-zlib.patch deleted file mode 100644 index b76dd00..0000000 --- a/SOURCES/clang-hardcode-have-zlib.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 47e5b1e80979631b6476e99f78d7a6ae17d1a8ff Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 21 Feb 2017 23:58:19 +0000 -Subject: [PATCH] test: Hard-code have_zlib to "1" in lit.site.cfg.in - -The stand-alone clang builds don't do zlib detection at all, so -have_zlib is always false, which is incorrect, since we build llvm -with zlib enabled. - -This fixes Driver/nozlibcompress.c ---- - test/lit.site.cfg.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in -index f368c99..5ca4d03 100644 ---- a/test/lit.site.cfg.in -+++ b/test/lit.site.cfg.in -@@ -14,7 +14,7 @@ config.clang_tools_dir = "@CLANG_TOOLS_DIR@" - config.host_triple = "@LLVM_HOST_TRIPLE@" - config.target_triple = "@TARGET_TRIPLE@" - config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" --config.have_zlib = "@HAVE_LIBZ@" -+config.have_zlib = "1" - config.clang_arcmt = @ENABLE_CLANG_ARCMT@ - config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@ - config.clang_examples = @ENABLE_CLANG_EXAMPLES@ --- -2.9.3 diff --git a/SOURCES/fix-cmake-include.patch b/SOURCES/fix-cmake-include.patch deleted file mode 100644 index 842b5c1..0000000 --- a/SOURCES/fix-cmake-include.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -up llvm-3.8.0rc2.src/CMakeLists.txt.fixinc llvm-3.8.0rc2.src/CMakeLists.txt ---- llvm-3.8.0rc2.src/CMakeLists.txt.fixinc 2016-01-14 05:03:44.000000000 +1000 -+++ llvm-3.8.0rc2.src/CMakeLists.txt 2016-02-26 10:21:44.477295728 +1000 -@@ -192,6 +192,7 @@ else() - endif() - - # Each of them corresponds to llvm-config's. -+# - set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir - set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) # --libdir - set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root -@@ -558,6 +559,11 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LL - set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) - set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) - -+if(INCLUDE_INSTALL_DIR) -+else() -+set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include) -+endif() -+ - set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) - if (APPLE) - set(CMAKE_INSTALL_NAME_DIR "@rpath") -@@ -728,7 +734,7 @@ add_subdirectory(cmake/modules) - - if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - install(DIRECTORY include/llvm include/llvm-c -- DESTINATION include -+ DESTINATION "${INCLUDE_INSTALL_DIR}" - COMPONENT llvm-headers - FILES_MATCHING - PATTERN "*.def" -@@ -740,7 +746,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - ) - - install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm -- DESTINATION include -+ DESTINATION "${INCLUDE_INSTALL_DIR}" - COMPONENT llvm-headers - FILES_MATCHING - PATTERN "*.def" diff --git a/SOURCES/rust-lang-clang-pr47.patch b/SOURCES/rust-lang-clang-pr47.patch deleted file mode 100644 index 1abadc8..0000000 --- a/SOURCES/rust-lang-clang-pr47.patch +++ /dev/null @@ -1,38 +0,0 @@ -From d4852c7a1a3ac86af2ac9197da4d26f49f270ab9 Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Sun, 7 Aug 2016 08:28:58 +0000 -Subject: [PATCH] Update clang tests for LLVM r277950 - -We infer inbounds on GEPs of allocas leading to minor perturbations in -tests. - -git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277953 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - test/CodeGenObjCXX/exceptions-legacy.mm | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/CodeGenObjCXX/exceptions-legacy.mm b/test/CodeGenObjCXX/exceptions-legacy.mm -index dac259d..0650509 100644 ---- a/test/CodeGenObjCXX/exceptions-legacy.mm -+++ b/test/CodeGenObjCXX/exceptions-legacy.mm -@@ -16,7 +16,7 @@ void test0(id obj) { - // Enter the @synchronized block. - // CHECK: call i32 @objc_sync_enter(i8* [[OBJ:%.*]]) - // CHECK: call void @objc_exception_try_enter([[BUF_T:%.*]]* nonnull [[BUF:%.*]]) --// CHECK-NEXT: [[T0:%.*]] = getelementptr [[BUF_T]], [[BUF_T]]* [[BUF]], i32 0, i32 0, i32 0 -+// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[BUF_T]], [[BUF_T]]* [[BUF]], i32 0, i32 0, i32 0 - // CHECK-NEXT: [[T1:%.*]] = call i32 @_setjmp(i32* [[T0]]) - // CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0 - // CHECK-NEXT: br i1 [[T2]], -@@ -55,7 +55,7 @@ void test1(id obj, bool *failed) { - // CHECK-LABEL: define void @_Z5test1P11objc_objectPb( - // Enter the @try block. - // CHECK: call void @objc_exception_try_enter([[BUF_T]]* nonnull [[BUF:%.*]]) --// CHECK-NEXT: [[T0:%.*]] = getelementptr [[BUF_T]], [[BUF_T]]* [[BUF]], i32 0, i32 0, i32 0 -+// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[BUF_T]], [[BUF_T]]* [[BUF]], i32 0, i32 0, i32 0 - // CHECK-NEXT: [[T1:%.*]] = call i32 @_setjmp(i32* [[T0]]) - // CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0 - // CHECK-NEXT: br i1 [[T2]], --- -1.8.3.1 - diff --git a/SOURCES/rust-lang-llvm-pr47.patch b/SOURCES/rust-lang-llvm-pr47.patch deleted file mode 100644 index 2457068..0000000 --- a/SOURCES/rust-lang-llvm-pr47.patch +++ /dev/null @@ -1,272 +0,0 @@ -From ae32815f9281a5a8d48014e180901fcdb658285a Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Sun, 7 Aug 2016 07:58:00 +0000 -Subject: [rust-lang/llvm#47 1/4] [InstCombine] Infer inbounds on geps of - allocas - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277950 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Transforms/InstCombine/InstructionCombining.cpp | 19 +++++++++++++++++++ - test/Transforms/InstCombine/getelementptr.ll | 6 +++--- - 2 files changed, 22 insertions(+), 3 deletions(-) - -diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp -index 377ccb9c37f7..31b5ad6ae8af 100644 ---- a/lib/Transforms/InstCombine/InstructionCombining.cpp -+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp -@@ -1898,6 +1898,25 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { - } - } - -+ if (!GEP.isInBounds()) { -+ unsigned PtrWidth = -+ DL.getPointerSizeInBits(PtrOp->getType()->getPointerAddressSpace()); -+ APInt BasePtrOffset(PtrWidth, 0); -+ Value *UnderlyingPtrOp = -+ PtrOp->stripAndAccumulateInBoundsConstantOffsets(DL, -+ BasePtrOffset); -+ if (auto *AI = dyn_cast(UnderlyingPtrOp)) { -+ if (GEP.accumulateConstantOffset(DL, BasePtrOffset) && -+ BasePtrOffset.isNonNegative()) { -+ APInt AllocSize(PtrWidth, DL.getTypeAllocSize(AI->getAllocatedType())); -+ if (BasePtrOffset.ule(AllocSize)) { -+ return GetElementPtrInst::CreateInBounds( -+ PtrOp, makeArrayRef(Ops).slice(1), GEP.getName()); -+ } -+ } -+ } -+ } -+ - return nullptr; - } - -diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll -index 7446734e210c..14abd84fd18e 100644 ---- a/test/Transforms/InstCombine/getelementptr.ll -+++ b/test/Transforms/InstCombine/getelementptr.ll -@@ -366,7 +366,7 @@ define i32 @test21() { - %rval = load i32, i32* %pbobel - ret i32 %rval - ; CHECK-LABEL: @test21( --; CHECK: getelementptr %intstruct, %intstruct* %pbob1, i64 0, i32 0 -+; CHECK: getelementptr inbounds %intstruct, %intstruct* %pbob1, i64 0, i32 0 - } - - -@@ -540,8 +540,8 @@ define i8* @test32(i8* %v) { - %G = load i8*, i8** %F - ret i8* %G - ; CHECK-LABEL: @test32( --; CHECK: %D = getelementptr [4 x i8*], [4 x i8*]* %A, i64 0, i64 1 --; CHECK: %F = getelementptr [4 x i8*], [4 x i8*]* %A, i64 0, i64 2 -+; CHECK: %D = getelementptr inbounds [4 x i8*], [4 x i8*]* %A, i64 0, i64 1 -+; CHECK: %F = getelementptr inbounds [4 x i8*], [4 x i8*]* %A, i64 0, i64 2 - } - - ; PR3290 --- -2.7.4 - -From d31c987130ff1bf9cea9a287195ecceda91c37d1 Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Sun, 7 Aug 2016 07:58:10 +0000 -Subject: [rust-lang/llvm#47 2/4] [InstSimplify] Try hard to simplify pointer - comparisons - -Simplify ptrtoint comparisons involving operands with different source -types. - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277951 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Analysis/InstructionSimplify.cpp | 10 ++++++++++ - test/Transforms/InstSimplify/compare.ll | 13 +++++++++++++ - 2 files changed, 23 insertions(+) - -diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp -index 7c6edbfca270..8b70d89d62cb 100644 ---- a/lib/Analysis/InstructionSimplify.cpp -+++ b/lib/Analysis/InstructionSimplify.cpp -@@ -3092,6 +3092,16 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, - if (LHS->getType()->isPointerTy()) - if (auto *C = computePointerICmp(Q.DL, Q.TLI, Q.DT, Pred, Q.CxtI, LHS, RHS)) - return C; -+ if (auto *CLHS = dyn_cast(LHS)) -+ if (auto *CRHS = dyn_cast(RHS)) -+ if (Q.DL.getTypeSizeInBits(CLHS->getPointerOperandType()) == -+ Q.DL.getTypeSizeInBits(CLHS->getType()) && -+ Q.DL.getTypeSizeInBits(CRHS->getPointerOperandType()) == -+ Q.DL.getTypeSizeInBits(CRHS->getType())) -+ if (auto *C = computePointerICmp(Q.DL, Q.TLI, Q.DT, Pred, Q.CxtI, -+ CLHS->getPointerOperand(), -+ CRHS->getPointerOperand())) -+ return C; - - if (GetElementPtrInst *GLHS = dyn_cast(LHS)) { - if (GEPOperator *GRHS = dyn_cast(RHS)) { -diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll -index 9d6fd74ae56f..3e7316ec6b48 100644 ---- a/test/Transforms/InstSimplify/compare.ll -+++ b/test/Transforms/InstSimplify/compare.ll -@@ -205,6 +205,19 @@ define i1 @gep16(i8* %ptr, i32 %a) { - ; CHECK-NEXT: ret i1 false - } - -+define i1 @gep17() { -+; CHECK-LABEL: @gep17( -+ %alloca = alloca i32, align 4 -+ %bc = bitcast i32* %alloca to [4 x i8]* -+ %gep1 = getelementptr inbounds i32, i32* %alloca, i32 1 -+ %pti1 = ptrtoint i32* %gep1 to i32 -+ %gep2 = getelementptr inbounds [4 x i8], [4 x i8]* %bc, i32 0, i32 1 -+ %pti2 = ptrtoint i8* %gep2 to i32 -+ %cmp = icmp ugt i32 %pti1, %pti2 -+ ret i1 %cmp -+; CHECK-NEXT: ret i1 true -+} -+ - define i1 @zext(i32 %x) { - ; CHECK-LABEL: @zext( - %e1 = zext i32 %x to i64 --- -2.7.4 - -From bd3e05cb1f5293635edff14fcf23cfc73985c977 Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Sun, 7 Aug 2016 07:58:12 +0000 -Subject: [rust-lang/llvm#47 3/4] [InstSimplify] Fold gep (gep V, C), (sub 0, - V) to C - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277952 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Analysis/InstructionSimplify.cpp | 20 ++++++++++++++++++++ - test/Transforms/InstSimplify/compare.ll | 13 +++++++++++++ - 2 files changed, 33 insertions(+) - -diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp -index 8b70d89d62cb..9d2a47957125 100644 ---- a/lib/Analysis/InstructionSimplify.cpp -+++ b/lib/Analysis/InstructionSimplify.cpp -@@ -3597,6 +3597,26 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef Ops, - } - } - -+ // gep (gep V, C), (sub 0, V) -> C -+ if (Q.DL.getTypeAllocSize(LastType) == 1 && -+ all_of(Ops.slice(1).drop_back(1), -+ [](Value *Idx) { return match(Idx, m_Zero()); })) { -+ unsigned PtrWidth = -+ Q.DL.getPointerSizeInBits(Ops[0]->getType()->getPointerAddressSpace()); -+ if (Q.DL.getTypeSizeInBits(Ops.back()->getType()) == PtrWidth) { -+ APInt BasePtrOffset(PtrWidth, 0); -+ Value *StrippedBasePtr = -+ Ops[0]->stripAndAccumulateInBoundsConstantOffsets(Q.DL, -+ BasePtrOffset); -+ -+ if (match(Ops.back(), -+ m_Sub(m_Zero(), m_PtrToInt(m_Specific(StrippedBasePtr))))) { -+ auto *CI = ConstantInt::get(GEPTy->getContext(), BasePtrOffset); -+ return ConstantExpr::getIntToPtr(CI, GEPTy); -+ } -+ } -+ } -+ - // Check to see if this is constant foldable. - for (unsigned i = 0, e = Ops.size(); i != e; ++i) - if (!isa(Ops[i])) -diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll -index 3e7316ec6b48..addb63c57222 100644 ---- a/test/Transforms/InstSimplify/compare.ll -+++ b/test/Transforms/InstSimplify/compare.ll -@@ -218,6 +218,19 @@ define i1 @gep17() { - ; CHECK-NEXT: ret i1 true - } - -+define i32 @gep18() { -+; CHECK-LABEL: @gep18( -+ %alloca = alloca i32, align 4 ; alloca + 0 -+ %gep = getelementptr inbounds i32, i32* %alloca, i32 1 ; alloca + 4 -+ %bc = bitcast i32* %gep to [4 x i8]* ; alloca + 4 -+ %pti = ptrtoint i32* %alloca to i32 ; alloca -+ %sub = sub i32 0, %pti ; -alloca -+ %add = getelementptr [4 x i8], [4 x i8]* %bc, i32 0, i32 %sub ; alloca + 4 - alloca == 4 -+ %add_to_int = ptrtoint i8* %add to i32 ; 4 -+ ret i32 %add_to_int ; 4 -+; CHECK-NEXT: ret i32 4 -+} -+ - define i1 @zext(i32 %x) { - ; CHECK-LABEL: @zext( - %e1 = zext i32 %x to i64 --- -2.7.4 - -From c3eb3c7608f439231d0c1340af6b720f113b4bf4 Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Tue, 16 Aug 2016 06:13:46 +0000 -Subject: [rust-lang/llvm#47 4/4] [InstSimplify] Fold gep (gep V, C), (xor V, - -1) to C-1 - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278779 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Analysis/InstructionSimplify.cpp | 8 +++++++- - test/Transforms/InstSimplify/compare.ll | 13 ------------- - 2 files changed, 7 insertions(+), 14 deletions(-) - -diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp -index 9d2a47957125..f7a435d1ad46 100644 ---- a/lib/Analysis/InstructionSimplify.cpp -+++ b/lib/Analysis/InstructionSimplify.cpp -@@ -3597,7 +3597,6 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef Ops, - } - } - -- // gep (gep V, C), (sub 0, V) -> C - if (Q.DL.getTypeAllocSize(LastType) == 1 && - all_of(Ops.slice(1).drop_back(1), - [](Value *Idx) { return match(Idx, m_Zero()); })) { -@@ -3609,11 +3608,18 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef Ops, - Ops[0]->stripAndAccumulateInBoundsConstantOffsets(Q.DL, - BasePtrOffset); - -+ // gep (gep V, C), (sub 0, V) -> C - if (match(Ops.back(), - m_Sub(m_Zero(), m_PtrToInt(m_Specific(StrippedBasePtr))))) { - auto *CI = ConstantInt::get(GEPTy->getContext(), BasePtrOffset); - return ConstantExpr::getIntToPtr(CI, GEPTy); - } -+ // gep (gep V, C), (xor V, -1) -> C-1 -+ if (match(Ops.back(), -+ m_Xor(m_PtrToInt(m_Specific(StrippedBasePtr)), m_AllOnes()))) { -+ auto *CI = ConstantInt::get(GEPTy->getContext(), BasePtrOffset - 1); -+ return ConstantExpr::getIntToPtr(CI, GEPTy); -+ } - } - } - -diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll -index addb63c57222..3e7316ec6b48 100644 ---- a/test/Transforms/InstSimplify/compare.ll -+++ b/test/Transforms/InstSimplify/compare.ll -@@ -218,19 +218,6 @@ define i1 @gep17() { - ; CHECK-NEXT: ret i1 true - } - --define i32 @gep18() { --; CHECK-LABEL: @gep18( -- %alloca = alloca i32, align 4 ; alloca + 0 -- %gep = getelementptr inbounds i32, i32* %alloca, i32 1 ; alloca + 4 -- %bc = bitcast i32* %gep to [4 x i8]* ; alloca + 4 -- %pti = ptrtoint i32* %alloca to i32 ; alloca -- %sub = sub i32 0, %pti ; -alloca -- %add = getelementptr [4 x i8], [4 x i8]* %bc, i32 0, i32 %sub ; alloca + 4 - alloca == 4 -- %add_to_int = ptrtoint i8* %add to i32 ; 4 -- ret i32 %add_to_int ; 4 --; CHECK-NEXT: ret i32 4 --} -- - define i1 @zext(i32 %x) { - ; CHECK-LABEL: @zext( - %e1 = zext i32 %x to i64 --- -2.7.4 - diff --git a/SOURCES/rust-lang-llvm-pr53.patch b/SOURCES/rust-lang-llvm-pr53.patch deleted file mode 100644 index 05970a1..0000000 --- a/SOURCES/rust-lang-llvm-pr53.patch +++ /dev/null @@ -1,349 +0,0 @@ -From 0d4331af6e01235479e44f9775b3fde9e19200a3 Mon Sep 17 00:00:00 2001 -From: Keith Walker -Date: Tue, 27 Sep 2016 16:46:07 +0000 -Subject: [rust-lang/llvm#53 1/2] Propagate DBG_VALUE entries when there are - unvisited predecessors - -Variables are sometimes missing their debug location information in -blocks in which the variables should be available. This would occur -when one or more predecessor blocks had not yet been visited by the -routine which propagated the information from predecessor blocks. - -This is addressed by only considering predecessor blocks which have -already been visited. - -The solution to this problem was suggested by Daniel Berlin on the -LLVM developer mailing list. - -Differential Revision: https://reviews.llvm.org/D24927 - - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282506 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/CodeGen/LiveDebugValues.cpp | 34 ++-- - test/CodeGen/ARM/dbg-range-extension.mir | 282 +++++++++++++++++++++++++++++++ - 2 files changed, 306 insertions(+), 10 deletions(-) - create mode 100644 test/CodeGen/ARM/dbg-range-extension.mir - -diff --git a/lib/CodeGen/LiveDebugValues.cpp b/lib/CodeGen/LiveDebugValues.cpp -index 4ff88d528108..4cadd5855ed5 100644 ---- a/lib/CodeGen/LiveDebugValues.cpp -+++ b/lib/CodeGen/LiveDebugValues.cpp -@@ -201,7 +201,8 @@ private: - VarLocInMBB &OutLocs, VarLocMap &VarLocIDs); - - bool join(MachineBasicBlock &MBB, VarLocInMBB &OutLocs, VarLocInMBB &InLocs, -- const VarLocMap &VarLocIDs); -+ const VarLocMap &VarLocIDs, -+ SmallPtrSet &Visited); - - bool ExtendRanges(MachineFunction &MF); - -@@ -368,7 +369,8 @@ bool LiveDebugValues::transfer(MachineInstr &MI, OpenRangesSet &OpenRanges, - /// inserting a new DBG_VALUE instruction at the start of the @MBB - if the same - /// source variable in all the predecessors of @MBB reside in the same location. - bool LiveDebugValues::join(MachineBasicBlock &MBB, VarLocInMBB &OutLocs, -- VarLocInMBB &InLocs, const VarLocMap &VarLocIDs) { -+ VarLocInMBB &InLocs, const VarLocMap &VarLocIDs, -+ SmallPtrSet &Visited) { - DEBUG(dbgs() << "join MBB: " << MBB.getName() << "\n"); - bool Changed = false; - -@@ -376,21 +378,32 @@ bool LiveDebugValues::join(MachineBasicBlock &MBB, VarLocInMBB &OutLocs, - - // For all predecessors of this MBB, find the set of VarLocs that - // can be joined. -+ int NumVisited = 0; - for (auto p : MBB.predecessors()) { -+ // Ignore unvisited predecessor blocks. As we are processing -+ // the blocks in reverse post-order any unvisited block can -+ // be considered to not remove any incoming values. -+ if (!Visited.count(p)) -+ continue; - auto OL = OutLocs.find(p); - // Join is null in case of empty OutLocs from any of the pred. - if (OL == OutLocs.end()) - return false; - -- // Just copy over the Out locs to incoming locs for the first predecessor. -- if (p == *MBB.pred_begin()) { -+ // Just copy over the Out locs to incoming locs for the first visited -+ // predecessor, and for all other predecessors join the Out locs. -+ if (!NumVisited) - InLocsT = OL->second; -- continue; -- } -- // Join with this predecessor. -- InLocsT &= OL->second; -+ else -+ InLocsT &= OL->second; -+ NumVisited++; - } - -+ // As we are processing blocks in reverse post-order we -+ // should have processed at least one predecessor, unless it -+ // is the entry block which has no predecessor. -+ assert((NumVisited || MBB.pred_empty()) && -+ "Should have processed at least one predecessor"); - if (InLocsT.empty()) - return false; - -@@ -463,6 +476,7 @@ bool LiveDebugValues::ExtendRanges(MachineFunction &MF) { - // To solve it, we perform join() and transfer() using the two worklist method - // until the ranges converge. - // Ranges have converged when both worklists are empty. -+ SmallPtrSet Visited; - while (!Worklist.empty() || !Pending.empty()) { - // We track what is on the pending worklist to avoid inserting the same - // thing twice. We could avoid this with a custom priority queue, but this -@@ -471,8 +485,8 @@ bool LiveDebugValues::ExtendRanges(MachineFunction &MF) { - while (!Worklist.empty()) { - MachineBasicBlock *MBB = OrderToBB[Worklist.top()]; - Worklist.pop(); -- MBBJoined = join(*MBB, OutLocs, InLocs, VarLocIDs); -- -+ MBBJoined = join(*MBB, OutLocs, InLocs, VarLocIDs, Visited); -+ Visited.insert(MBB); - if (MBBJoined) { - MBBJoined = false; - Changed = true; --- -2.7.4 - -From 8a0fc26559123bb6eab3ceae93d5a2c94943614b Mon Sep 17 00:00:00 2001 -From: Adrian Prantl -Date: Wed, 28 Sep 2016 17:51:14 +0000 -Subject: [rust-lang/llvm#53 2/2] Teach LiveDebugValues about lexical scopes. - -This addresses PR26055 LiveDebugValues is very slow. - -Contrary to the old LiveDebugVariables pass LiveDebugValues currently -doesn't look at the lexical scopes before inserting a DBG_VALUE -intrinsic. This means that we often propagate DBG_VALUEs much further -down than necessary. This is especially noticeable in large C++ -functions with many inlined method calls that all use the same -"this"-pointer. - -For example, in the following code it makes no sense to propagate the -inlined variable a from the first inlined call to f() into any of the -subsequent basic blocks, because the variable will always be out of -scope: - -void sink(int a); -void __attribute((always_inline)) f(int a) { sink(a); } -void foo(int i) { - f(i); - if (i) - f(i); - f(i); -} - -This patch reuses the LexicalScopes infrastructure we have for -LiveDebugVariables to take this into account. - -The effect on compile time and memory consumption is quite noticeable: -I tested a benchmark that is a large C++ source with an enormous -amount of inlined "this"-pointers that would previously eat >24GiB -(most of them for DBG_VALUE intrinsics) and whose compile time was -dominated by LiveDebugValues. With this patch applied the memory -consumption is 1GiB and 1.7% of the time is spent in LiveDebugValues. - -https://reviews.llvm.org/D24994 -Thanks to Daniel Berlin and Keith Walker for reviewing! - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282611 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/CodeGen/LiveDebugValues.cpp | 51 ++++- - test/CodeGen/ARM/dbg-range-extension.mir | 1 - - test/DebugInfo/COFF/register-variables.ll | 8 +- - test/DebugInfo/MIR/X86/livedebugvalues-limit.mir | 228 +++++++++++++++++++++++ - test/DebugInfo/X86/fission-ranges.ll | 6 +- - 5 files changed, 278 insertions(+), 16 deletions(-) - create mode 100644 test/DebugInfo/MIR/X86/livedebugvalues-limit.mir - -diff --git a/lib/CodeGen/LiveDebugValues.cpp b/lib/CodeGen/LiveDebugValues.cpp -index 4cadd5855ed5..969944eb24a2 100644 ---- a/lib/CodeGen/LiveDebugValues.cpp -+++ b/lib/CodeGen/LiveDebugValues.cpp -@@ -23,6 +23,7 @@ - #include "llvm/ADT/SparseBitVector.h" - #include "llvm/ADT/Statistic.h" - #include "llvm/ADT/UniqueVector.h" -+#include "llvm/CodeGen/LexicalScopes.h" - #include "llvm/CodeGen/MachineFunction.h" - #include "llvm/CodeGen/MachineFunctionPass.h" - #include "llvm/CodeGen/MachineInstrBuilder.h" -@@ -60,6 +61,26 @@ class LiveDebugValues : public MachineFunctionPass { - private: - const TargetRegisterInfo *TRI; - const TargetInstrInfo *TII; -+ LexicalScopes LS; -+ -+ /// Keeps track of lexical scopes associated with a user value's source -+ /// location. -+ class UserValueScopes { -+ DebugLoc DL; -+ LexicalScopes &LS; -+ SmallPtrSet LBlocks; -+ -+ public: -+ UserValueScopes(DebugLoc D, LexicalScopes &L) : DL(std::move(D)), LS(L) {} -+ -+ /// Return true if current scope dominates at least one machine -+ /// instruction in a given machine basic block. -+ bool dominates(MachineBasicBlock *MBB) { -+ if (LBlocks.empty()) -+ LS.getMachineBasicBlocks(DL, LBlocks); -+ return LBlocks.count(MBB) != 0 || LS.dominates(DL, MBB); -+ } -+ }; - - /// Based on std::pair so it can be used as an index into a DenseMap. - typedef std::pair -@@ -83,7 +104,7 @@ private: - struct VarLoc { - const DebugVariable Var; - const MachineInstr &MI; ///< Only used for cloning a new DBG_VALUE. -- -+ mutable UserValueScopes UVS; - enum { InvalidKind = 0, RegisterKind } Kind; - - /// The value location. Stored separately to avoid repeatedly -@@ -96,9 +117,9 @@ private: - uint64_t Hash; - } Loc; - -- VarLoc(const MachineInstr &MI) -+ VarLoc(const MachineInstr &MI, LexicalScopes &LS) - : Var(MI.getDebugVariable(), MI.getDebugLoc()->getInlinedAt()), MI(MI), -- Kind(InvalidKind) { -+ UVS(MI.getDebugLoc(), LS), Kind(InvalidKind) { - static_assert((sizeof(Loc) == sizeof(uint64_t)), - "hash does not cover all members of Loc"); - assert(MI.isDebugValue() && "not a DBG_VALUE"); -@@ -125,6 +146,10 @@ private: - return 0; - } - -+ /// Determine whether the lexical scope of this value's debug location -+ /// dominates MBB. -+ bool dominates(MachineBasicBlock &MBB) const { return UVS.dominates(&MBB); } -+ - void dump() const { MI.dump(); } - - bool operator==(const VarLoc &Other) const { -@@ -229,6 +254,7 @@ public: - /// Calculate the liveness information for the given machine function. - bool runOnMachineFunction(MachineFunction &MF) override; - }; -+ - } // namespace - - //===----------------------------------------------------------------------===// -@@ -295,7 +321,7 @@ void LiveDebugValues::transferDebugValue(const MachineInstr &MI, - // Add the VarLoc to OpenRanges from this DBG_VALUE. - // TODO: Currently handles DBG_VALUE which has only reg as location. - if (isDbgValueDescribedByReg(MI)) { -- VarLoc VL(MI); -+ VarLoc VL(MI, LS); - unsigned ID = VarLocIDs.insert(VL); - OpenRanges.insert(ID, VL.Var); - } -@@ -399,6 +425,13 @@ bool LiveDebugValues::join(MachineBasicBlock &MBB, VarLocInMBB &OutLocs, - NumVisited++; - } - -+ // Filter out DBG_VALUES that are out of scope. -+ VarLocSet KillSet; -+ for (auto ID : InLocsT) -+ if (!VarLocIDs[ID].dominates(MBB)) -+ KillSet.set(ID); -+ InLocsT.intersectWithComplement(KillSet); -+ - // As we are processing blocks in reverse post-order we - // should have processed at least one predecessor, unless it - // is the entry block which has no predecessor. -@@ -519,12 +552,14 @@ bool LiveDebugValues::ExtendRanges(MachineFunction &MF) { - } - - bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) { -+ if (!MF.getFunction()->getSubprogram()) -+ // LiveDebugValues will already have removed all DBG_VALUEs. -+ return false; -+ - TRI = MF.getSubtarget().getRegisterInfo(); - TII = MF.getSubtarget().getInstrInfo(); -+ LS.initialize(MF); - -- bool Changed = false; -- -- Changed |= ExtendRanges(MF); -- -+ bool Changed = ExtendRanges(MF); - return Changed; - } -diff --git a/test/DebugInfo/COFF/register-variables.ll b/test/DebugInfo/COFF/register-variables.ll -index 9bb782853a3d..08246fef9603 100644 ---- a/test/DebugInfo/COFF/register-variables.ll -+++ b/test/DebugInfo/COFF/register-variables.ll -@@ -37,8 +37,8 @@ - ; ASM: #DEBUG_VALUE: c <- %EAX - ; ASM: testl %esi, %esi - ; ASM: je .LBB0_2 -+; ASM: [[after_je:\.Ltmp.*]]: - ; ASM: # BB#1: # %if.then --; ASM-DAG: #DEBUG_VALUE: c <- %EAX - ; ASM-DAG: #DEBUG_VALUE: inlineinc:a <- %EAX - ; ASM-DAG: #DEBUG_VALUE: a <- %EAX - ; ASM-DAG: #DEBUG_VALUE: f:p <- %ESI -@@ -65,7 +65,7 @@ - ; ASM: .cv_def_range [[after_getint]] [[after_inc_eax]], "A\021\021\000\000\000" - ; ASM: .short 4414 # Record kind: S_LOCAL - ; ASM: .asciz "c" --; ASM: .cv_def_range [[after_getint]] [[after_inc_eax]], "A\021\021\000\000\000" -+; ASM: .cv_def_range [[after_getint]] [[after_je]], "A\021\021\000\000\000" - ; ASM: .short 4414 # Record kind: S_LOCAL - ; ASM: .asciz "b" - ; ASM: .cv_def_range [[after_inc_eax]] [[after_if]], "A\021\021\000\000\000" -@@ -132,7 +132,7 @@ - ; OBJ: LocalVariableAddrRange { - ; OBJ: OffsetStart: .text+0xC - ; OBJ: ISectStart: 0x0 --; OBJ: Range: 0x6 -+; OBJ: Range: 0x4 - ; OBJ: } - ; OBJ: } - ; OBJ: Local { -@@ -143,7 +143,7 @@ - ; OBJ: } - ; OBJ: DefRangeRegister { - ; OBJ: Register: 17 --; OBJ: LocalVariableAddrRange { -+; OBJ: MayHaveNoName: 0 - ; OBJ: OffsetStart: .text+0x12 - ; OBJ: ISectStart: 0x0 - ; OBJ: Range: 0x6 -diff --git a/test/DebugInfo/X86/fission-ranges.ll b/test/DebugInfo/X86/fission-ranges.ll -index 3c05f223ee79..0dfb13ab66b7 100644 ---- a/test/DebugInfo/X86/fission-ranges.ll -+++ b/test/DebugInfo/X86/fission-ranges.ll -@@ -32,13 +32,13 @@ - ; CHECK-NEXT: Length: 25 - ; CHECK-NEXT: Location description: 50 93 04 - ; CHECK: [[E]]: Beginning address index: 4 --; CHECK-NEXT: Length: 23 -+; CHECK-NEXT: Length: 19 - ; CHECK-NEXT: Location description: 50 93 04 - ; CHECK: [[B]]: Beginning address index: 5 --; CHECK-NEXT: Length: 21 -+; CHECK-NEXT: Length: 17 - ; CHECK-NEXT: Location description: 50 93 04 - ; CHECK: [[D]]: Beginning address index: 6 --; CHECK-NEXT: Length: 21 -+; CHECK-NEXT: Length: 17 - ; CHECK-NEXT: Location description: 50 93 04 - - ; Make sure we don't produce any relocations in any .dwo section (though in particular, debug_info.dwo) --- -2.7.4 - diff --git a/SOURCES/rust-lang-llvm-pr54.patch b/SOURCES/rust-lang-llvm-pr54.patch deleted file mode 100644 index 942e74e..0000000 --- a/SOURCES/rust-lang-llvm-pr54.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 9b74379db3f9e30516f053138fd3697d42b23164 Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Fri, 7 Oct 2016 01:38:35 +0000 -Subject: [rust-lang/llvm#54] [SimplifyCFG] Correctly test for unconditional - branches in GetCaseResults - -GetCaseResults assumed that a terminator with one successor was an -unconditional branch. This is not necessarily the case, it could be a -cleanupret. - -Strengthen the check by querying whether or not the terminator is -exceptional. - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283517 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Transforms/Utils/SimplifyCFG.cpp | 2 +- - .../SimplifyCFG/X86/switch_to_lookup_table.ll | 60 ++++++++++++++++++++++ - 2 files changed, 61 insertions(+), 1 deletion(-) - -diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp -index c197317ac771..d274f97296dc 100644 ---- a/lib/Transforms/Utils/SimplifyCFG.cpp -+++ b/lib/Transforms/Utils/SimplifyCFG.cpp -@@ -4228,7 +4228,7 @@ GetCaseResults(SwitchInst *SI, ConstantInt *CaseVal, BasicBlock *CaseDest, - ++I) { - if (TerminatorInst *T = dyn_cast(I)) { - // If the terminator is a simple branch, continue to the next block. -- if (T->getNumSuccessors() != 1) -+ if (T->getNumSuccessors() != 1 || T->isExceptional()) - return false; - Pred = CaseDest; - CaseDest = T->getSuccessor(0); -diff --git a/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll b/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll -index bae8c1dc5a4b..77e355a00528 100644 ---- a/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll -+++ b/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll -@@ -1334,3 +1334,63 @@ cleanup4: - br label %while.body - } - -+declare void @throw(i1) -+ -+define void @wineh_test(i64 %val) personality i32 (...)* @__CxxFrameHandler3 { -+entry: -+ invoke void @throw(i1 false) -+ to label %unreachable unwind label %cleanup1 -+ -+unreachable: -+ unreachable -+ -+cleanup1: -+ %cleanuppad1 = cleanuppad within none [] -+ switch i64 %val, label %cleanupdone2 [ -+ i64 0, label %cleanupdone1 -+ i64 1, label %cleanupdone1 -+ i64 6, label %cleanupdone1 -+ ] -+ -+cleanupdone1: -+ cleanupret from %cleanuppad1 unwind label %cleanup2 -+ -+cleanupdone2: -+ cleanupret from %cleanuppad1 unwind label %cleanup2 -+ -+cleanup2: -+ %phi = phi i1 [ true, %cleanupdone1 ], [ false, %cleanupdone2 ] -+ %cleanuppad2 = cleanuppad within none [] -+ call void @throw(i1 %phi) [ "funclet"(token %cleanuppad2) ] -+ unreachable -+} -+ -+; CHECK-LABEL: @wineh_test( -+; CHECK: entry: -+; CHECK: invoke void @throw(i1 false) -+; CHECK: to label %[[unreachable:.*]] unwind label %[[cleanup1:.*]] -+ -+; CHECK: [[unreachable]]: -+; CHECK: unreachable -+ -+; CHECK: [[cleanup1]]: -+; CHECK: %[[cleanuppad1:.*]] = cleanuppad within none [] -+; CHECK: switch i64 %val, label %[[cleanupdone2:.*]] [ -+; CHECK: i64 0, label %[[cleanupdone1:.*]] -+; CHECK: i64 1, label %[[cleanupdone1]] -+; CHECK: i64 6, label %[[cleanupdone1]] -+; CHECK: ] -+ -+; CHECK: [[cleanupdone1]]: -+; CHECK: cleanupret from %[[cleanuppad1]] unwind label %[[cleanup2:.*]] -+ -+; CHECK: [[cleanupdone2]]: -+; CHECK: cleanupret from %[[cleanuppad1]] unwind label %[[cleanup2]] -+ -+; CHECK: [[cleanup2]]: -+; CHECK: %[[phi:.*]] = phi i1 [ true, %[[cleanupdone1]] ], [ false, %[[cleanupdone2]] ] -+; CHECK: %[[cleanuppad2:.*]] = cleanuppad within none [] -+; CHECK: call void @throw(i1 %[[phi]]) [ "funclet"(token %[[cleanuppad2]]) ] -+; CHECK: unreachable -+ -+declare i32 @__CxxFrameHandler3(...) --- -2.7.4 - diff --git a/SOURCES/rust-lang-llvm-pr55.patch b/SOURCES/rust-lang-llvm-pr55.patch deleted file mode 100644 index f534f31..0000000 --- a/SOURCES/rust-lang-llvm-pr55.patch +++ /dev/null @@ -1,85 +0,0 @@ -From eff5dc809ed54701f2bb3e15c58d01881299cedf Mon Sep 17 00:00:00 2001 -From: David Majnemer -Date: Tue, 11 Oct 2016 01:00:45 +0000 -Subject: [rust-lang/llvm#55] [InstCombine] Transform !range metadata to - !nonnull when combining loads - -When combining an integer load with !range metadata that does not include 0 to a pointer load, make sure emit !nonnull metadata on the newly-created pointer load. This prevents the !nonnull metadata from being dropped during a ptrtoint/inttoptr pair. - -This fixes PR30597. - -Patch by Ariel Ben-Yehuda! - -Differential Revision: https://reviews.llvm.org/D25215 - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283836 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - .../InstCombine/InstCombineLoadStoreAlloca.cpp | 12 ++++++-- - test/Transforms/InstCombine/PR30597.ll | 32 ++++++++++++++++++++++ - 2 files changed, 42 insertions(+), 2 deletions(-) - create mode 100644 test/Transforms/InstCombine/PR30597.ll - -diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -index d312983ed51b..26f4e764501a 100644 ---- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -+++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -@@ -380,8 +380,16 @@ static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewT - break; - case LLVMContext::MD_range: - // FIXME: It would be nice to propagate this in some way, but the type -- // conversions make it hard. If the new type is a pointer, we could -- // translate it to !nonnull metadata. -+ // conversions make it hard. -+ -+ // If it's a pointer now and the range does not contain 0, make it !nonnull. -+ if (NewTy->isPointerTy()) { -+ unsigned BitWidth = IC.getDataLayout().getTypeSizeInBits(NewTy); -+ if (!getConstantRangeFromMetadata(*N).contains(APInt(BitWidth, 0))) { -+ MDNode *NN = MDNode::get(LI.getContext(), None); -+ NewLoad->setMetadata(LLVMContext::MD_nonnull, NN); -+ } -+ } - break; - } - } -diff --git a/test/Transforms/InstCombine/PR30597.ll b/test/Transforms/InstCombine/PR30597.ll -new file mode 100644 -index 000000000000..c0803ed71204 ---- /dev/null -+++ b/test/Transforms/InstCombine/PR30597.ll -@@ -0,0 +1,32 @@ -+; RUN: opt < %s -instcombine -S | FileCheck %s -+ -+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -+target triple = "x86_64-unknown-linux-gnu" -+ -+; Function Attrs: readonly uwtable -+define i1 @dot_ref_s(i32** noalias nocapture readonly dereferenceable(8)) { -+entry-block: -+ %loadedptr = load i32*, i32** %0, align 8, !nonnull !0 -+ %ptrtoint = ptrtoint i32* %loadedptr to i64 -+ %inttoptr = inttoptr i64 %ptrtoint to i32* -+ %switchtmp = icmp eq i32* %inttoptr, null -+ ret i1 %switchtmp -+ -+; CHECK-LABEL: @dot_ref_s -+; CHECK-NEXT: entry-block: -+; CHECK-NEXT: ret i1 false -+} -+ -+; Function Attrs: readonly uwtable -+define i64* @function(i64* noalias nocapture readonly dereferenceable(8)) { -+entry-block: -+ %loaded = load i64, i64* %0, align 8, !range !1 -+ %inttoptr = inttoptr i64 %loaded to i64* -+ ret i64* %inttoptr -+; CHECK-LABEL: @function -+; CHECK: %{{.+}} = load i64*, i64** %{{.+}}, align 8, !nonnull -+} -+ -+ -+!0 = !{} -+!1 = !{i64 1, i64 140737488355327} --- -2.9.3 - diff --git a/SOURCES/rust-lang-llvm-pr57.patch b/SOURCES/rust-lang-llvm-pr57.patch deleted file mode 100644 index 24b6a58..0000000 --- a/SOURCES/rust-lang-llvm-pr57.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5ac4f80be3e8b5d42475aeaba246455e0016c7ef Mon Sep 17 00:00:00 2001 -From: Anthony Ramine -Date: Sun, 27 Nov 2016 16:28:12 +0100 -Subject: [rust-lang/llvm#57] Backport rL277331 - ---- - lib/Target/AArch64/AArch64InstrInfo.cpp | 3 + - .../MIR/AArch64/inst-size-tlsdesc-callseq.mir | 84 ++++++++++++++++++++++ - 2 files changed, 87 insertions(+) - create mode 100644 test/CodeGen/MIR/AArch64/inst-size-tlsdesc-callseq.mir - -diff --git a/lib/Target/AArch64/AArch64InstrInfo.cpp b/lib/Target/AArch64/AArch64InstrInfo.cpp -index 0aa4708f35ac..d39542a8e4eb 100644 ---- a/lib/Target/AArch64/AArch64InstrInfo.cpp -+++ b/lib/Target/AArch64/AArch64InstrInfo.cpp -@@ -56,6 +56,9 @@ unsigned AArch64InstrInfo::GetInstSizeInBytes(const MachineInstr &MI) const { - case TargetOpcode::IMPLICIT_DEF: - case TargetOpcode::KILL: - return 0; -+ case AArch64::TLSDESC_CALLSEQ: -+ // This gets lowered to an instruction sequence which takes 16 bytes -+ return 16; - } - - llvm_unreachable("GetInstSizeInBytes()- Unable to determin insn size"); --- -2.9.3 - diff --git a/SPECS/llvm.spec b/SPECS/llvm.spec index 99ee9dd..48cca5b 100644 --- a/SPECS/llvm.spec +++ b/SPECS/llvm.spec @@ -1,3 +1,7 @@ +%global maj_ver 5 +%global min_ver 0 +%global patch_ver 0 + # Components enabled if supported by target architecture: %ifarch %ix86 x86_64 %bcond_without gold @@ -36,8 +40,8 @@ ExcludeArch: ppc s390 %{?rhel6:s390x} %global llvm_lib_suffix rhel Name: llvm-private -Version: 3.9.1 -Release: 9%{?dist} +Version: %{maj_ver}.%{min_ver}.%{patch_ver} +Release: 3%{?dist} Summary: llvm engine for Mesa Group: System Environment/Libraries @@ -49,17 +53,8 @@ Source2: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz Source100: llvm-config.h Source101: clang-config.h -Patch1: fix-cmake-include.patch -Patch2: clang-hardcode-have-zlib.patch -# Clang patch for changes in rust-lang-llvm-pr47.patch (LLVM r277951 to be exact). -Patch3: rust-lang-clang-pr47.patch -# backports cribbed from https://github.com/rust-lang/llvm/ -Patch47: rust-lang-llvm-pr47.patch -Patch53: rust-lang-llvm-pr53.patch -Patch54: rust-lang-llvm-pr54.patch -Patch55: rust-lang-llvm-pr55.patch -Patch57: rust-lang-llvm-pr57.patch - +Patch1: 0001-Fix-CMake-include-patch.patch +Patch2: 0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch BuildRequires: cmake BuildRequires: zlib-devel @@ -85,19 +80,12 @@ support in Mesa. %prep %setup -T -q -b 2 -n cfe-%{version}.src -%patch2 -p1 -b .havezlib -%patch3 -p1 -b .clangrust47 - %setup -q -n llvm-%{version}.src tar xf %{SOURCE1} %patch1 -p1 -b .fixinc -%patch47 -p1 -b .rust47 -%patch53 -p1 -b .rust53 -%patch54 -p1 -b .rust54 -%patch55 -p1 -b .rust55 -%patch57 -p1 -b .rust57 +%patch2 -p1 -b .xscvdpsp %build @@ -129,7 +117,7 @@ export PATH=$BUILD_DIR/bin:$PATH -DLLVM_LIBDIR_SUFFIX= \ %endif \ - -DLLVM_TARGETS_TO_BUILD="%{host_target}%{?amdgpu}" \ + -DLLVM_TARGETS_TO_BUILD="%{host_target}%{?amdgpu};BPF" \ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ -DLLVM_ENABLE_ZLIB:BOOL=ON \ -DLLVM_ENABLE_FFI:BOOL=OFF \ @@ -269,7 +257,7 @@ make check-all || : %files %doc LICENSE.TXT -%{_libdir}/libLLVM-3.9*-%{llvm_lib_suffix}.so +%{_libdir}/libLLVM-%{maj_ver}.%{min_ver}*-%{llvm_lib_suffix}.so %{_libdir}/clang-private/libclang*.so* %files devel @@ -282,6 +270,15 @@ make check-all || : %{_libdir}/clang/%{version}/include %changelog +* Thu Dec 14 2017 Tom Stellard - 5.0.0-3 +- Backport r312612 from upstream llvm: [PowerPC] Don't use xscvdpspn on the P7 + +* Thu Oct 19 2017 Tom Stellard - 5.0.0-2 +- Enable BPF target + +* Thu Oct 12 2017 Tom Stellard - 5.0.0-1 +- Update to 5.0.0 + * Thu Jun 01 2017 Tilmann Scheller - 3.9.1-9 - Fix two Clang test failures and enable Clang regression tests during build.