From nobody Thu Jul 25 22:00:39 2024 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 4WVPvr1MRvz5RPLm; Thu, 25 Jul 2024 22:00:40 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WVPvr0knMz4Kq3; Thu, 25 Jul 2024 22:00:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721944840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EZDRwP0E1mAZfFgcbBg9cmN6rfwUvB96I7QYuTmR4HI=; b=Joun4poT/LbVEcpH5Uh3uzmyiC2/lPNB4QuE4aPA4mAcTcE4X0N4K+cZdcvGYaR4c6XupA XPvIBx0l9NPdqjeeVioossSvAUSL7XF3URd+HRdpCtExUE37QVYKsmR8dkb2mEAXxKzBTr 2EP9q94Y8onH3V1BbUiaqXKLWTjDmfby3DMUi7iyvqxKzSxIxchxgqcizc4BjtoN3TzqhA z8H37TjeHY1VB0IOElP+g28fBvDCw5m/IyPq8Alw4NUumwc0jO5ghBxi1bd4Fsu2iufMCN sSkBej1GVguCr/a2bF/0HVaqQoWs2Kb7YbSjMVq1RHwr9kc9GOFRczFMd0oJGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721944840; a=rsa-sha256; cv=none; b=jz91Yftz3ewVrxZnY/uiisvIpY4MiaC5X3G8oIdB3S5wAsvjTPJMBN09SWnUdI7V4dBdaz 53xZz3K5K0Uo3gbriTrhGXNFhA5KVsRW2E99GFquT5jV5Q4M0kVvr9TMDjvC02KA7oI3CX tZOg5DaNE5DL+mFp/I3lhAp0FUby77v3Xkpg3TjOAg4A5D8UzBsR2ClP4h2vRnwkmDYK7O VKQ2hhE8FiTz0uR/o1cKKQ7vq1pyD7wvOVeVew99zpyiY9Ad140u67PjSBU4puL2czmRgM KnOfSqP4UPCuJgsVuwbye2lH3vYBHRZNqMuoW/Ng1qjPJ9ZysWZLL1ousNChwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721944840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EZDRwP0E1mAZfFgcbBg9cmN6rfwUvB96I7QYuTmR4HI=; b=nCnjN98t40BTviM8l2zbZJxkpEK1jsl/ErwrsX4yfzjCFnE/+HqkWJ16cikkoND3beE9vr mep5gwWfj085ZYieJvbRNRfMCrxk4oX3JIsZ4hLSKkrx+uG3WN9p/kl1IqN33weqMugJMl jrEAhNbZkxJ8qOc/Nfpau6dvjji2CH7qYLC1nT6BLDk3RwmqFuXpgZNUXz3P9oy4+ImRW6 e5kaOhSpxJ1QJEyHqTYB7YnYwUcfQOHUaAxn4S0MajDix8qrhqLf9rV4a4ofjcsA8T9yVX FWtNnPKzfnyt46ZGW9zVvsgGjju5XYhHChtHuWCoyG/0kTcG7auJEAP82f+5fw== 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 4WVPvr0LFjz1BgY; Thu, 25 Jul 2024 22:00:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46PM0dXH089684; Thu, 25 Jul 2024 22:00:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46PM0d80089681; Thu, 25 Jul 2024 22:00:39 GMT (envelope-from git) Date: Thu, 25 Jul 2024 22:00:39 GMT Message-Id: <202407252200.46PM0d80089681@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Brooks Davis Subject: git: a4e0cb2fd99a - main - devel/llvm18: fix host dependent compiler output for i386 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: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a4e0cb2fd99adef4cbd4f778be729a079a5f2dea Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/ports/commit/?id=a4e0cb2fd99adef4cbd4f778be729a079a5f2dea commit a4e0cb2fd99adef4cbd4f778be729a079a5f2dea Author: Brooks Davis AuthorDate: 2024-07-25 22:00:32 +0000 Commit: Brooks Davis CommitDate: 2024-07-25 22:00:32 +0000 devel/llvm18: fix host dependent compiler output for i386 Merge fixes for a couple cases where the compiler generated different i386 code depending on the host. In the base system this showed up as very small differences in a couple object files in buildworld for i386 depending on the host architecture (i386 or amd64). PR: 276961 --- devel/llvm18/Makefile | 2 +- .../files/patch-backport-freebsd-397c2693fa6 | 43 +++++++ .../files/patch-backport-freebsd-55a2a91c5e1 | 128 +++++++++++++++++++++ 3 files changed, 172 insertions(+), 1 deletion(-) diff --git a/devel/llvm18/Makefile b/devel/llvm18/Makefile index 5148732975be..7f85ff1cdd4f 100644 --- a/devel/llvm18/Makefile +++ b/devel/llvm18/Makefile @@ -1,6 +1,6 @@ PORTNAME= llvm DISTVERSION= 18.1.8 -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= devel lang MASTER_SITES= https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ PKGNAMESUFFIX= ${LLVM_SUFFIX} diff --git a/devel/llvm18/files/patch-backport-freebsd-397c2693fa6 b/devel/llvm18/files/patch-backport-freebsd-397c2693fa6 new file mode 100644 index 000000000000..f000829474ba --- /dev/null +++ b/devel/llvm18/files/patch-backport-freebsd-397c2693fa6 @@ -0,0 +1,43 @@ +commit 397c2693fa66508cb5e6b173650a1f3bc6c4dd4f +Author: Dimitry Andric +Date: Sun Jul 21 22:37:27 2024 +0200 + + Fix llvm register allocator for native/cross build differences + + Work around an issue in LLVM's register allocator, which can cause + slightly different i386 object files, when produced by a native or cross + build of clang. + + This adds another volatile qualifier to a float variable declaration in + the weightCalcHelper() function, which otherwise produces slightly + different float results on amd64 and i386 hosts. In turn, this can lead + to different (but equivalent) register choices, and thus non-identical + assembly code. + + See https://github.com/llvm/llvm-project/issues/99396 for more details. + + Note this is a temporary fix, meant to merge in time for 13.4. As soon + as upstream has a permanent solution we will import that. + + PR: 276961 + Reported by: cperciva + MFC after: 3 days + +diff --git llvm/lib/CodeGen/CalcSpillWeights.cpp llvm/lib/CodeGen/CalcSpillWeights.cpp +index f3cb7fa5af61..afde8d001f88 100644 +--- llvm/lib/CodeGen/CalcSpillWeights.cpp ++++ llvm/lib/CodeGen/CalcSpillWeights.cpp +@@ -256,7 +256,12 @@ float VirtRegAuxInfo::weightCalcHelper(LiveInterval &LI, SlotIndex *Start, + return -1.0f; + } + +- float Weight = 1.0f; ++ // FreeBSD customization: similar to the HWeight declaration below, add a ++ // volatile qualifier to avoid slightly different weight results on amd64 ++ // and i386 hosts, and possibly choosing different registers in the register ++ // allocator. See for ++ // more details. ++ volatile float Weight = 1.0f; + if (IsSpillable) { + // Get loop info for mi. + if (MI->getParent() != MBB) { diff --git a/devel/llvm18/files/patch-backport-freebsd-55a2a91c5e1 b/devel/llvm18/files/patch-backport-freebsd-55a2a91c5e1 new file mode 100644 index 000000000000..8843d3749348 --- /dev/null +++ b/devel/llvm18/files/patch-backport-freebsd-55a2a91c5e1 @@ -0,0 +1,128 @@ +commit 55a2a91c5e1bb39dd625ba56597608883fbcb318 +Author: Dimitry Andric +Date: Thu Jul 25 13:13:45 2024 +0200 + + Merge commit 28a2b85602a5 from llvm-project (by Kazu Hirata): + + [DeadStoreElimination] Use SmallSetVector (NFC) (#79410) + + The use of SmallSetVector saves 0.58% of heap allocations during the + compilation of a large preprocessed file, namely X86ISelLowering.cpp, + for the X86 target. During the experiment, the final size of ToCheck + was 8 or less 88% of the time. + + Merge commit 9e95c4947d31 from llvm-project (by Nikita Popov): + + [DSE] Fix non-determinism due to address reuse (#84943) + + The malloc->calloc fold creates a new MemoryAccess, which may end of at + the same address as a previously deleted access inside SkipStores. + + To the most part, this is not a problem, because SkipStores is normally + only used together with MemDefs. Neither the old malloc access nor the + new calloc access will be part of MemDefs, so there is no problem here. + + However, SkipStores is also used in one more place: In the main DSE + loop, ToCheck entries are checked against it. Fix this by not using + SkipStores here, and instead using a separate set to track deletions + inside this loop. This way it is not affected by the calloc optimization + that happens outside it. + + This is all pretty ugly, but I haven't found another good way to fix it. + Suggestions welcome. + + No test case as I don't have a reliable DSE-only test-case for this. + + Fixes https://github.com/llvm/llvm-project/issues/84458. + + This fixes another possible difference in output when building i386 + object files with a native or cross build of clang. (Specifically, the + file sbin/ipf/ipmon/ipmon.o.) + + PR: 276961 + Reported by: cperciva + MFC after: 3 days + +diff --git llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +index 380d65836553..f0f0f5f28025 100644 +--- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp ++++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +@@ -1697,7 +1697,9 @@ struct DSEState { + + /// Delete dead memory defs and recursively add their operands to ToRemove if + /// they became dead. +- void deleteDeadInstruction(Instruction *SI) { ++ void ++ deleteDeadInstruction(Instruction *SI, ++ SmallPtrSetImpl *Deleted = nullptr) { + MemorySSAUpdater Updater(&MSSA); + SmallVector NowDeadInsts; + NowDeadInsts.push_back(SI); +@@ -1718,6 +1720,8 @@ struct DSEState { + if (IsMemDef) { + auto *MD = cast(MA); + SkipStores.insert(MD); ++ if (Deleted) ++ Deleted->insert(MD); + if (auto *SI = dyn_cast(MD->getMemoryInst())) { + if (SI->getValueOperand()->getType()->isPointerTy()) { + const Value *UO = getUnderlyingObject(SI->getValueOperand()); +@@ -2111,7 +2115,12 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA, + unsigned WalkerStepLimit = MemorySSAUpwardsStepLimit; + unsigned PartialLimit = MemorySSAPartialStoreLimit; + // Worklist of MemoryAccesses that may be killed by KillingDef. +- SetVector ToCheck; ++ SmallSetVector ToCheck; ++ // Track MemoryAccesses that have been deleted in the loop below, so we can ++ // skip them. Don't use SkipStores for this, which may contain reused ++ // MemoryAccess addresses. ++ SmallPtrSet Deleted; ++ [[maybe_unused]] unsigned OrigNumSkipStores = State.SkipStores.size(); + ToCheck.insert(KillingDef->getDefiningAccess()); + + bool Shortend = false; +@@ -2119,7 +2128,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA, + // Check if MemoryAccesses in the worklist are killed by KillingDef. + for (unsigned I = 0; I < ToCheck.size(); I++) { + MemoryAccess *Current = ToCheck[I]; +- if (State.SkipStores.count(Current)) ++ if (Deleted.contains(Current)) + continue; + + std::optional MaybeDeadAccess = State.getDomMemoryDef( +@@ -2166,7 +2175,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA, + continue; + LLVM_DEBUG(dbgs() << "DSE: Remove Dead Store:\n DEAD: " << *DeadI + << "\n KILLER: " << *KillingI << '\n'); +- State.deleteDeadInstruction(DeadI); ++ State.deleteDeadInstruction(DeadI, &Deleted); + ++NumFastStores; + MadeChange = true; + } else { +@@ -2203,7 +2212,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA, + Shortend = true; + // Remove killing store and remove any outstanding overlap + // intervals for the updated store. +- State.deleteDeadInstruction(KillingSI); ++ State.deleteDeadInstruction(KillingSI, &Deleted); + auto I = State.IOLs.find(DeadSI->getParent()); + if (I != State.IOLs.end()) + I->second.erase(DeadSI); +@@ -2215,13 +2224,16 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA, + if (OR == OW_Complete) { + LLVM_DEBUG(dbgs() << "DSE: Remove Dead Store:\n DEAD: " << *DeadI + << "\n KILLER: " << *KillingI << '\n'); +- State.deleteDeadInstruction(DeadI); ++ State.deleteDeadInstruction(DeadI, &Deleted); + ++NumFastStores; + MadeChange = true; + } + } + } + ++ assert(State.SkipStores.size() - OrigNumSkipStores == Deleted.size() && ++ "SkipStores and Deleted out of sync?"); ++ + // Check if the store is a no-op. + if (!Shortend && State.storeIsNoop(KillingDef, KillingUndObj)) { + LLVM_DEBUG(dbgs() << "DSE: Remove No-Op Store:\n DEAD: " << *KillingI