[llvm] [Transforms] Remove unused functions (NFC) (PR #226655)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 26 00:53:59 PDT 2026
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/226655
createAnyOfReduction:
The last caller was removed on January 18, 2026 in commit
ae1bd068db293c494c4c6314da3b9d138706460d.
canHaveUnrollRemainder:
The last caller, in an assert, was removed on May 1, 2026 in commit
316f0d3bfeaf7eee7b6d4ae60d357a8216ec5264.
Assisted-by: Antigravity
>From 59a58bc75e8cb0241093c9444ded981538eb1ae5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 25 Sep 2026 09:56:10 -0700
Subject: [PATCH] [Transforms] Remove unused functions (NFC)
createAnyOfReduction:
The last caller was removed on January 18, 2026 in commit
ae1bd068db293c494c4c6314da3b9d138706460d.
canHaveUnrollRemainder:
The last caller, in an assert, was removed on May 1, 2026 in commit
316f0d3bfeaf7eee7b6d4ae60d357a8216ec5264.
Assisted-by: Antigravity
---
.../include/llvm/Transforms/Utils/LoopUtils.h | 5 ----
llvm/lib/Transforms/Utils/LoopUnroll.cpp | 20 -------------
llvm/lib/Transforms/Utils/LoopUtils.cpp | 30 -------------------
3 files changed, 55 deletions(-)
diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index 74c549be35ddff..a68b9289853169 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -550,11 +550,6 @@ LLVM_ABI Value *createSimpleReduction(IRBuilderBase &B, Value *Src,
RecurKind RdxKind, Value *Mask,
Value *EVL);
-/// Create a reduction of the given vector \p Src for a reduction of kind
-/// RecurKind::AnyOf. The start value of the reduction is \p InitVal.
-LLVM_ABI Value *createAnyOfReduction(IRBuilderBase &B, Value *Src,
- Value *InitVal, PHINode *OrigPhi);
-
/// Create an ordered reduction intrinsic using the given recurrence
/// kind \p RdxKind.
LLVM_ABI Value *createOrderedReduction(IRBuilderBase &B, RecurKind RdxKind,
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
index e80dd18a34fb7e..d7517fd1660ea6 100644
--- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
@@ -426,26 +426,6 @@ void llvm::simplifyLoopAfterUnroll(Loop *L, bool SimplifyIVs, LoopInfo *LI,
}
}
-// Loops containing convergent instructions that are uncontrolled or controlled
-// from outside the loop must have a count that divides their TripMultiple.
-LLVM_ATTRIBUTE_USED
-static bool canHaveUnrollRemainder(const Loop *L) {
- if (getLoopConvergenceHeart(L))
- return false;
-
- // Check for uncontrolled convergent operations.
- for (auto &BB : L->blocks()) {
- for (auto &I : *BB) {
- if (isa<ConvergenceControlInst>(I))
- return true;
- if (auto *CB = dyn_cast<CallBase>(&I))
- if (CB->isConvergent())
- return CB->getConvergenceControlToken();
- }
- }
- return true;
-}
-
// If LoopUnroll has proven OriginalLoopProb is incorrect for some iterations
// of the original loop, adjust latch probabilities in the unrolled loop to
// maintain the original total frequency of the original loop body.
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 784c8331526110..0599f045c4f840 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1497,36 +1497,6 @@ Value *llvm::getShuffleReduction(IRBuilderBase &Builder, Value *Src,
return Builder.CreateExtractElement(TmpVec, Builder.getInt32(0));
}
-Value *llvm::createAnyOfReduction(IRBuilderBase &Builder, Value *Src,
- Value *InitVal, PHINode *OrigPhi) {
- Value *NewVal = nullptr;
-
- // First use the original phi to determine the new value we're trying to
- // select from in the loop.
- SelectInst *SI = nullptr;
- for (auto *U : OrigPhi->users()) {
- if ((SI = dyn_cast<SelectInst>(U)))
- break;
- }
- assert(SI && "One user of the original phi should be a select");
-
- if (SI->getTrueValue() == OrigPhi)
- NewVal = SI->getFalseValue();
- else {
- assert(SI->getFalseValue() == OrigPhi &&
- "At least one input to the select should be the original Phi");
- NewVal = SI->getTrueValue();
- }
-
- // If any predicate is true it means that we want to select the new value.
- Value *AnyOf =
- Src->getType()->isVectorTy() ? Builder.CreateOrReduce(Src) : Src;
- // The compares in the loop may yield poison, which propagates through the
- // bitwise ORs. Freeze it here before the condition is used.
- AnyOf = Builder.CreateFreeze(AnyOf);
- return Builder.CreateSelect(AnyOf, NewVal, InitVal, "rdx.select");
-}
-
Value *llvm::getReductionIdentity(Intrinsic::ID RdxID, Type *Ty,
FastMathFlags Flags) {
bool Negative = false;
More information about the llvm-commits
mailing list