[llvm] [SCEV] Strip dead gcd function (NFC) (PR #217299)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 03:58:03 PDT 2026


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/217299

None

>From 3a1c49ec2138b4bb07fc941d868db046ddf3ed1b Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <artagnon at tenstorrent.com>
Date: Wed, 19 Aug 2026 11:56:36 +0100
Subject: [PATCH] [SCEV] Strip dead gcd function (NFC)

---
 llvm/lib/Analysis/ScalarEvolution.cpp | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 52a03d2cad62d..d8ba1fec1b838 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -3695,20 +3695,6 @@ const SCEV *ScalarEvolution::getUDivExpr(SCEVUse LHS, SCEVUse RHS) {
   return getOrCreateUDivExpr(LHS, RHS);
 }
 
-APInt gcd(const SCEVConstant *C1, const SCEVConstant *C2) {
-  APInt A = C1->getAPInt().abs();
-  APInt B = C2->getAPInt().abs();
-  uint32_t ABW = A.getBitWidth();
-  uint32_t BBW = B.getBitWidth();
-
-  if (ABW > BBW)
-    B = B.zext(ABW);
-  else if (ABW < BBW)
-    A = A.zext(BBW);
-
-  return APIntOps::GreatestCommonDivisor(std::move(A), std::move(B));
-}
-
 /// Get a canonical unsigned division expression, or something simpler if
 /// possible. There is no representation for an exact udiv in SCEV IR, but we
 /// can attempt to optimize it prior to construction.



More information about the llvm-commits mailing list