From d6dbc8d2d9dd0e554b0d3fbb809be79674d29337 Mon Sep 17 00:00:00 2001 From: liyunfei Date: Tue, 9 Dec 2025 11:36:44 +0800 Subject: [PATCH] update to llvm-for-oE-17.0.6-2512.0.2 --- 0006-fix-for-prefix-c.patch | 32 --- ...nhance-rotate-loop-in-blockplacement.patch | 249 ------------------ ...r.gz => llvm-for-oE-17.0.6-2512.0.2.tar.gz | 4 +- llvm.spec | 16 +- 4 files changed, 11 insertions(+), 290 deletions(-) delete mode 100644 0006-fix-for-prefix-c.patch delete mode 100644 0007-CodeGen-enhance-rotate-loop-in-blockplacement.patch rename llvm-for-oE-17.0.6-2512.0.1.tar.gz => llvm-for-oE-17.0.6-2512.0.2.tar.gz (32%) diff --git a/0006-fix-for-prefix-c.patch b/0006-fix-for-prefix-c.patch deleted file mode 100644 index f5334c8..0000000 --- a/0006-fix-for-prefix-c.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/clang/test/Driver/prefix.c b/clang/test/Driver/prefix.c -index b429187a49d3..9010ac0622a6 100644 ---- a/clang/test/Driver/prefix.c -+++ b/clang/test/Driver/prefix.c -@@ -1,8 +1,8 @@ - // RUN: %clang %s --// RUN: %clang -iprefix $(dirname `which clang`)/../lib/clang/*/ -iwithprefix include %s -+// RUN: %clang -iprefix %resource_dir/../ -iwithprefix include %s - // RUN: %clang -iwithprefix include %s - // RUN: %clang -nostdinc -iwithprefix include %s -fgcc-compatible --// RUN: %clang -nostdinc -iprefix $(dirname `which clang`)/../lib/clang/*/ -iwithprefix include %s -fgcc-compatible -+// RUN: %clang -nostdinc -iprefix %resource_dir/../ -iwithprefix include %s -fgcc-compatible - // RUN: not %clang -nostdinc -iwithprefix include %s - // RUN: not %clang -nostdinc -iprefix "" -iwithprefix include %s - -diff --git a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt -index 43886d57ca5a..105540f64c94 100644 ---- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt -+++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt -@@ -67,8 +67,6 @@ install(PROGRAMS run-clang-tidy.py - DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT clang-tidy - RENAME run-clang-tidy) --if(LLVM_BSPUB_COMMON) -- install(PROGRAMS clang-tidy-stats.py -- DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" -- COMPONENT clang-tidy) --endif() -+install(PROGRAMS clang-tidy-stats.py -+ DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" -+ COMPONENT clang-tidy) --- \ No newline at end of file diff --git a/0007-CodeGen-enhance-rotate-loop-in-blockplacement.patch b/0007-CodeGen-enhance-rotate-loop-in-blockplacement.patch deleted file mode 100644 index 7e8fbdc..0000000 --- a/0007-CodeGen-enhance-rotate-loop-in-blockplacement.patch +++ /dev/null @@ -1,249 +0,0 @@ -From 1872a6d3a691385be96857ab8a4fcd0a0553dd47 Mon Sep 17 00:00:00 2001 -From: zengyong <2595650269@qq.com> -Date: Mon, 17 Nov 2025 14:21:12 +0800 -Subject: [PATCH] [CodeGen] enhance rotate loop in blockplacement 1. delete an - unnecessary condition in findBestLoopExit 2. similar to findBestLoopTop, - caculate fallthrough gains via rotating loop 3. update test - ---- - llvm/lib/CodeGen/MachineBlockPlacement.cpp | 122 ++++++++++--------- - llvm/test/CodeGen/X86/bb_rotate.ll | 6 +- - llvm/test/CodeGen/X86/loop-rotate.ll | 4 +- - llvm/test/CodeGen/X86/lsr-negative-stride.ll | 14 +-- - 4 files changed, 75 insertions(+), 71 deletions(-) - -diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp -index b69045b4d61f..d93be6a065f8 100644 ---- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp -+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp -@@ -2216,13 +2216,6 @@ MachineBlockPlacement::findBestLoopExit(const MachineLoop &L, - continue; - if (Succ == MBB) - continue; -- BlockChain &SuccChain = *BlockToChain[Succ]; -- // Don't split chains, either this chain or the successor's chain. -- if (&Chain == &SuccChain) { -- LLVM_DEBUG(dbgs() << " exiting: " << getBlockName(MBB) << " -> " -- << getBlockName(Succ) << " (chain conflict)\n"); -- continue; -- } - - auto SuccProb = MBPI->getEdgeProbability(MBB, Succ); - if (LoopBlockSet.count(Succ)) { -@@ -2322,12 +2315,29 @@ MachineBlockPlacement::hasViableTopFallthrough( - return false; - } - --/// Attempt to rotate an exiting block to the bottom of the loop. --/// --/// Once we have built a chain, try to rotate it to line up the hot exit block --/// with fallthrough out of the loop if doing so doesn't introduce unnecessary --/// branches. For example, if the loop has fallthrough into its header and out --/// of its bottom already, don't rotate it. -+// Compute the fallthrough gains via rotating loop, and rotate only when gains > 0 -+// -+// In following diagram, B0,B1...,Bn is a previously built loop chain, -+// Bk is the new bottom found by findBestLoopExit, edges markd as "-" are reduced fallthrough, -+// edges marked as "+" are increased fallthrough, this function computes -+// -+// SUM(increased fallthrough) - SUM(decreased fallthrough) -+// -+// | -+// | - -+// V -+// ---> B0 -+// | B1 -+// | . + -+// | Bk ---> -+// +| |- -+// | V -+// | Bk+1 -+// | . -+// | Bn-1 -+// --- Bn <--- -+// |- -+// - void MachineBlockPlacement::rotateLoop(BlockChain &LoopChain, - const MachineBasicBlock *ExitingBB, - BlockFrequency ExitFreq, -@@ -2346,57 +2356,53 @@ void MachineBlockPlacement::rotateLoop(BlockChain &LoopChain, - if (Top->isEntryBlock()) - return; - -- bool ViableTopFallthrough = hasViableTopFallthrough(Top, LoopBlockSet); -- -- // If the header has viable fallthrough, check whether the current loop -- // bottom is a viable exiting block. If so, bail out as rotating will -- // introduce an unnecessary branch. -- if (ViableTopFallthrough) { -- for (MachineBasicBlock *Succ : Bottom->successors()) { -- BlockChain *SuccChain = BlockToChain[Succ]; -- if (!LoopBlockSet.count(Succ) && -- (!SuccChain || Succ == *SuccChain->begin())) -- return; -- } -+ // ignore when bottom's successors is bigger than 2 (similar to find BestLoopTop) -+ if (Bottom->succ_size() > 2) -+ return; -+ -+ BlockFrequency FallThrough2Exit = BlockFrequency(0); - -- // Rotate will destroy the top fallthrough, we need to ensure the new exit -- // frequency is larger than top fallthrough. -- BlockFrequency FallThrough2Top = TopFallThroughFreq(Top, LoopBlockSet); -- if (FallThrough2Top >= ExitFreq) -- return; -+ if (Bottom->succ_size() == 2) { -+ MachineBasicBlock *Succ = *Bottom->succ_begin(); -+ if (Succ == Top) -+ Succ = *Bottom->succ_rbegin(); -+ BlockChain *SuccChain = BlockToChain[Succ]; -+ // fallthrough2exit exits only when succ is not in current loop and succ is in a chain's head -+ if (!LoopBlockSet.count(Succ) && -+ (!SuccChain || Succ == *SuccChain->begin())) -+ FallThrough2Exit = -+ MBFI->getBlockFreq(Bottom) * MBPI->getEdgeProbability(Bottom, Succ); - } - - BlockChain::iterator ExitIt = llvm::find(LoopChain, ExitingBB); - if (ExitIt == LoopChain.end()) - return; -- -- // Rotating a loop exit to the bottom when there is a fallthrough to top -- // trades the entry fallthrough for an exit fallthrough. -- // If there is no bottom->top edge, but the chosen exit block does have -- // a fallthrough, we break that fallthrough for nothing in return. -- -- // Let's consider an example. We have a built chain of basic blocks -- // B1, B2, ..., Bn, where Bk is a ExitingBB - chosen exit block. -- // By doing a rotation we get -- // Bk+1, ..., Bn, B1, ..., Bk -- // Break of fallthrough to B1 is compensated by a fallthrough from Bk. -- // If we had a fallthrough Bk -> Bk+1 it is broken now. -- // It might be compensated by fallthrough Bn -> B1. -- // So we have a condition to avoid creation of extra branch by loop rotation. -- // All below must be true to avoid loop rotation: -- // If there is a fallthrough to top (B1) -- // There was fallthrough from chosen exit block (Bk) to next one (Bk+1) -- // There is no fallthrough from bottom (Bn) to top (B1). -- // Please note that there is no exit fallthrough from Bn because we checked it -- // above. -- if (ViableTopFallthrough) { -- assert(std::next(ExitIt) != LoopChain.end() && -- "Exit should not be last BB"); -- MachineBasicBlock *NextBlockInChain = *std::next(ExitIt); -- if (ExitingBB->isSuccessor(NextBlockInChain)) -- if (!Bottom->isSuccessor(Top)) -- return; -- } -+ -+ assert(std::next(ExitIt) != LoopChain.end() && "Exit should not be last BB"); -+ MachineBasicBlock *NextBlockInChain = *std::next(ExitIt); -+ -+ BlockFrequency FallThroughFromPred = BlockFrequency(0); -+ BlockFrequency BackEdgeFreq = BlockFrequency(0); -+ -+ // fallthrough from bk to bk+1 -+ if (ExitingBB->isSuccessor(NextBlockInChain)) -+ FallThroughFromPred = MBFI->getBlockFreq(ExitingBB) * -+ MBPI->getEdgeProbability(ExitingBB, NextBlockInChain); -+ -+ // fallthrough from bottom to top -+ if (Bottom->isSuccessor(Top)) -+ BackEdgeFreq = -+ MBFI->getBlockFreq(Bottom) * MBPI->getEdgeProbability(Bottom, Top); -+ -+ BlockFrequency NewFreq = ExitFreq; -+ BlockFrequency FallThrough2Top = TopFallThroughFreq(Top, LoopBlockSet); -+ -+ BlockFrequency Gains = BackEdgeFreq + NewFreq; -+ BlockFrequency Lost = -+ FallThrough2Top + FallThrough2Exit + FallThroughFromPred; -+ -+ if (Lost >= Gains) -+ return; - - LLVM_DEBUG(dbgs() << "Rotating loop to put exit " << getBlockName(ExitingBB) - << " at bottom\n"); -diff --git a/llvm/test/CodeGen/X86/bb_rotate.ll b/llvm/test/CodeGen/X86/bb_rotate.ll -index 55a7b0138026..bc4f1f008b36 100644 ---- a/llvm/test/CodeGen/X86/bb_rotate.ll -+++ b/llvm/test/CodeGen/X86/bb_rotate.ll -@@ -4,13 +4,13 @@ define i1 @no_viable_top_fallthrough() { - ; CHECK-LABEL: no_viable_top_fallthrough - ; CHECK: %.entry - ; CHECK: %.bb1 -+; CHECK: %.exit -+; CHECK: %.stop -+; CHECK: %.header - ; CHECK: %.bb2 - ; CHECK: %.middle - ; CHECK: %.backedge - ; CHECK: %.bb3 --; CHECK: %.header --; CHECK: %.exit --; CHECK: %.stop - .entry: - %val1 = call i1 @foo() - br i1 %val1, label %.bb1, label %.header, !prof !10 -diff --git a/llvm/test/CodeGen/X86/loop-rotate.ll b/llvm/test/CodeGen/X86/loop-rotate.ll -index 3f0a390e7c1b..77104c021d51 100644 ---- a/llvm/test/CodeGen/X86/loop-rotate.ll -+++ b/llvm/test/CodeGen/X86/loop-rotate.ll -@@ -38,9 +38,9 @@ define void @do_rotate() { - ; CHECK: %entry - ; CHECK: %then - ; CHECK: %else -+; CHECK: %header - ; CHECK: %latch1 - ; CHECK: %latch2 --; CHECK: %header - ; CHECK: %end - entry: - %val0 = call i1 @foo() -@@ -76,10 +76,10 @@ define void @do_rotate2() { - ; CHECK-LABEL: do_rotate2 - ; CHECK: %entry - ; CHECK: %then -+; CHECK: %header - ; CHECK: %middle - ; CHECK: %latch1 - ; CHECK: %latch2 --; CHECK: %header - ; CHECK: %exit - entry: - %val0 = call i1 @foo() -diff --git a/llvm/test/CodeGen/X86/lsr-negative-stride.ll b/llvm/test/CodeGen/X86/lsr-negative-stride.ll -index 26c6128ab48d..924fd25ac62d 100644 ---- a/llvm/test/CodeGen/X86/lsr-negative-stride.ll -+++ b/llvm/test/CodeGen/X86/lsr-negative-stride.ll -@@ -24,6 +24,12 @@ define i32 @t(i32 %a, i32 %b) nounwind { - ; CHECK-NEXT: movl %edx, %eax - ; CHECK-NEXT: retl - ; CHECK-NEXT: .p2align 4, 0x90 -+; CHECK-NEXT: .LBB0_5: # %cond_false -+; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1 -+; CHECK-NEXT: subl %edx, %ecx -+; CHECK-NEXT: cmpl %edx, %ecx -+; CHECK-NEXT: movl %edx, %eax -+; CHECK-NEXT: je .LBB0_6 - ; CHECK-NEXT: .LBB0_2: # %bb.outer - ; CHECK-NEXT: # =>This Loop Header: Depth=1 - ; CHECK-NEXT: # Child Loop BB0_3 Depth 2 -@@ -39,14 +45,6 @@ define i32 @t(i32 %a, i32 %b) nounwind { - ; CHECK-NEXT: cmpl %eax, %ecx - ; CHECK-NEXT: movl %eax, %edx - ; CHECK-NEXT: jne .LBB0_3 --; CHECK-NEXT: jmp .LBB0_6 --; CHECK-NEXT: .p2align 4, 0x90 --; CHECK-NEXT: .LBB0_5: # %cond_false --; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1 --; CHECK-NEXT: subl %edx, %ecx --; CHECK-NEXT: cmpl %edx, %ecx --; CHECK-NEXT: movl %edx, %eax --; CHECK-NEXT: jne .LBB0_2 - ; CHECK-NEXT: .LBB0_6: # %bb17 - ; CHECK-NEXT: retl - entry: --- -Gitee diff --git a/llvm-for-oE-17.0.6-2512.0.1.tar.gz b/llvm-for-oE-17.0.6-2512.0.2.tar.gz similarity index 32% rename from llvm-for-oE-17.0.6-2512.0.1.tar.gz rename to llvm-for-oE-17.0.6-2512.0.2.tar.gz index 14d4ac0..4a42937 100644 --- a/llvm-for-oE-17.0.6-2512.0.1.tar.gz +++ b/llvm-for-oE-17.0.6-2512.0.2.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e037aa165150e01d69c8177e1772ff8afec9662ec8e9a3dfb1cf8624c60d5752 -size 212723878 +oid sha256:de47a7a1c226f217fabf4365b7878010585b5cabfb5dea037407ca44d983cb61 +size 212746115 diff --git a/llvm.spec b/llvm.spec index b640f47..b6f5c6d 100644 --- a/llvm.spec +++ b/llvm.spec @@ -38,7 +38,7 @@ %undefine __cmake_in_source_build -%global src_tarball llvm-for-oE-17.0.6-2512.0.1 +%global src_tarball llvm-for-oE-17.0.6-2512.0.2 %global src_tarball_dir llvm-project-%{src_tarball} #region LLVM globals @@ -159,12 +159,12 @@ #region packages #region main package %if %{with sys_llvm} -Name: llvm +Name: llvm %else -Name: llvm-toolset-%{maj_ver} +Name: llvm-toolset-%{maj_ver} %endif Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 55 +Release: 56 Summary: The Low Level Virtual Machine License: NCSA @@ -186,8 +186,6 @@ Patch0004: 0004-remove-cmake_minimum_required.patch %if %{with bisheng_autotuner} Patch0005: 0005-Fix-for-building-autotuner-with-mlir.patch %endif -Patch0006: 0006-fix-for-prefix-c.patch -Patch0007: 0007-CodeGen-enhance-rotate-loop-in-blockplacement.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -2974,11 +2972,11 @@ fi %files -n %{pkg_name_llvm_libunwind}-static %{install_libdir}/libunwind.a -%endif %files -n %{pkg_name_llvm_libunwind}-doc %license libunwind/LICENSE.TXT %doc %{_pkgdocdir}/html +%endif #endregion libcxx files #region BOLT files @@ -3014,6 +3012,10 @@ fi #endregion files %changelog +* Tue Dec 09 2025 liyunfei - 17.0.6-56 +- update to llvm-for-oe-17.0.6-2512.0.2 +- release-note https://gitee.com/openeuler/llvm-project/releases/tag/llvm-for-oE-17.0.6-2512.0.2 + * Wed Nov 26 2025 liyunfei - 17.0.6-55 - enhance rotate loop in blockplacement -- Gitee