From nobody Fri Oct 22 12:09:18 2021 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8950C181E4F0; Fri, 22 Oct 2021 12:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HbNSK0CSCz4RmV; Fri, 22 Oct 2021 12:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AC3D62BA; Fri, 22 Oct 2021 12:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19MC9ICI099121; Fri, 22 Oct 2021 12:09:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19MC9IvV099120; Fri, 22 Oct 2021 12:09:18 GMT (envelope-from git) Date: Fri, 22 Oct 2021 12:09:18 GMT Message-Id: <202110221209.19MC9IvV099120@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Piotr Kubaj Subject: git: ab467871db40 - main - devel/llvm12: fix/workaround liblzma incorrect compress/uncompress List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab467871db4051ab0162256fccdfe872ae40b959 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=ab467871db4051ab0162256fccdfe872ae40b959 commit ab467871db4051ab0162256fccdfe872ae40b959 Author: Piotr Kubaj AuthorDate: 2021-10-22 11:42:42 +0000 Commit: Piotr Kubaj CommitDate: 2021-10-22 11:42:42 +0000 devel/llvm12: fix/workaround liblzma incorrect compress/uncompress Apply https://reviews.freebsd.org/D31804 Fixes miscompiling liblzma. Submitted by: adalava --- ...lvm_include_llvm_Analysis_TargetTransformInfo.h | 10 +++ ...patch-llvm_lib_Analysis_TargetTransformInfo.cpp | 14 ++++ .../files/patch-llvm_lib_CodeGen_HardwareLoops.cpp | 75 ++++++++++++++++++++++ 3 files changed, 99 insertions(+) diff --git a/devel/llvm12/files/patch-llvm_include_llvm_Analysis_TargetTransformInfo.h b/devel/llvm12/files/patch-llvm_include_llvm_Analysis_TargetTransformInfo.h new file mode 100644 index 000000000000..07cad777ea24 --- /dev/null +++ b/devel/llvm12/files/patch-llvm_include_llvm_Analysis_TargetTransformInfo.h @@ -0,0 +1,10 @@ +--- llvm/include/llvm/Analysis/TargetTransformInfo.h.orig 2021-06-28 16:23:38 UTC ++++ llvm/include/llvm/Analysis/TargetTransformInfo.h +@@ -94,6 +94,7 @@ struct HardwareLoopInfo { + Loop *L = nullptr; + BasicBlock *ExitBlock = nullptr; + BranchInst *ExitBranch = nullptr; ++ const SCEV *ExitCount = nullptr; + const SCEV *TripCount = nullptr; + IntegerType *CountType = nullptr; + Value *LoopDecrement = nullptr; // Decrement the loop counter by this diff --git a/devel/llvm12/files/patch-llvm_lib_Analysis_TargetTransformInfo.cpp b/devel/llvm12/files/patch-llvm_lib_Analysis_TargetTransformInfo.cpp new file mode 100644 index 000000000000..566e910213f5 --- /dev/null +++ b/devel/llvm12/files/patch-llvm_lib_Analysis_TargetTransformInfo.cpp @@ -0,0 +1,14 @@ +--- llvm/lib/Analysis/TargetTransformInfo.cpp.orig 2021-06-28 16:23:38 UTC ++++ llvm/lib/Analysis/TargetTransformInfo.cpp +@@ -217,10 +217,7 @@ bool HardwareLoopInfo::isHardwareLoopCandidate(ScalarE + // Note that this block may not be the loop latch block, even if the loop + // has a latch block. + ExitBlock = BB; +- TripCount = SE.getAddExpr(EC, SE.getOne(EC->getType())); +- +- if (!EC->getType()->isPointerTy() && EC->getType() != CountType) +- TripCount = SE.getZeroExtendExpr(TripCount, CountType); ++ ExitCount = EC; + + break; + } diff --git a/devel/llvm12/files/patch-llvm_lib_CodeGen_HardwareLoops.cpp b/devel/llvm12/files/patch-llvm_lib_CodeGen_HardwareLoops.cpp new file mode 100644 index 000000000000..320f63aec550 --- /dev/null +++ b/devel/llvm12/files/patch-llvm_lib_CodeGen_HardwareLoops.cpp @@ -0,0 +1,75 @@ +--- llvm/lib/CodeGen/HardwareLoops.cpp.orig 2021-06-28 16:23:38 UTC ++++ llvm/lib/CodeGen/HardwareLoops.cpp +@@ -187,7 +187,7 @@ namespace { + const DataLayout &DL, + OptimizationRemarkEmitter *ORE) : + SE(SE), DL(DL), ORE(ORE), L(Info.L), M(L->getHeader()->getModule()), +- TripCount(Info.TripCount), ++ ExitCount(Info.ExitCount), + CountType(Info.CountType), + ExitBranch(Info.ExitBranch), + LoopDecrement(Info.LoopDecrement), +@@ -202,7 +202,7 @@ namespace { + OptimizationRemarkEmitter *ORE = nullptr; + Loop *L = nullptr; + Module *M = nullptr; +- const SCEV *TripCount = nullptr; ++ const SCEV *ExitCount = nullptr; + Type *CountType = nullptr; + BranchInst *ExitBranch = nullptr; + Value *LoopDecrement = nullptr; +@@ -298,7 +298,7 @@ bool HardwareLoops::TryConvertLoop(HardwareLoopInfo &H + } + + assert( +- (HWLoopInfo.ExitBlock && HWLoopInfo.ExitBranch && HWLoopInfo.TripCount) && ++ (HWLoopInfo.ExitBlock && HWLoopInfo.ExitBranch && HWLoopInfo.ExitCount) && + "Hardware Loop must have set exit info."); + + BasicBlock *Preheader = L->getLoopPreheader(); +@@ -384,12 +384,18 @@ Value *HardwareLoop::InitLoopCount() { + + SCEVExpander SCEVE(SE, DL, "loopcnt"); + ++ if (!ExitCount->getType()->isPointerTy() && ++ ExitCount->getType() != CountType) ++ ExitCount = SE.getZeroExtendExpr(ExitCount, CountType); ++ ++ ExitCount = SE.getAddExpr(ExitCount, SE.getOne(CountType)); ++ + // If we're trying to use the 'test and set' form of the intrinsic, we need + // to replace a conditional branch that is controlling entry to the loop. It + // is likely (guaranteed?) that the preheader has an unconditional branch to + // the loop header, so also check if it has a single predecessor. +- if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, TripCount, +- SE.getZero(TripCount->getType()))) { ++ if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, ExitCount, ++ SE.getZero(ExitCount->getType()))) { + LLVM_DEBUG(dbgs() << " - Attempting to use test.set counter.\n"); + UseLoopGuard |= ForceGuardLoopEntry; + } else +@@ -401,19 +407,19 @@ Value *HardwareLoop::InitLoopCount() { + BasicBlock *Predecessor = BB->getSinglePredecessor(); + // If it's not safe to create a while loop then don't force it and create a + // do-while loop instead +- if (!isSafeToExpandAt(TripCount, Predecessor->getTerminator(), SE)) ++ if (!isSafeToExpandAt(ExitCount, Predecessor->getTerminator(), SE)) + UseLoopGuard = false; + else + BB = Predecessor; + } + +- if (!isSafeToExpandAt(TripCount, BB->getTerminator(), SE)) { +- LLVM_DEBUG(dbgs() << "- Bailing, unsafe to expand TripCount " +- << *TripCount << "\n"); ++ if (!isSafeToExpandAt(ExitCount, BB->getTerminator(), SE)) { ++ LLVM_DEBUG(dbgs() << "- Bailing, unsafe to expand ExitCount " ++ << *ExitCount << "\n"); + return nullptr; + } + +- Value *Count = SCEVE.expandCodeFor(TripCount, CountType, ++ Value *Count = SCEVE.expandCodeFor(ExitCount, CountType, + BB->getTerminator()); + + // FIXME: We've expanded Count where we hope to insert the counter setting