[llvm] [Support] Remove an unnecessary cast (NFC) (PR #154048)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 17 19:54:17 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/154048

qp is already of uint64_t.


>From 791992b9c7626e8d80d082ad5f2ef7a8ecd7a69e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 17 Aug 2025 19:26:50 -0700
Subject: [PATCH] [Support] Remove an unnecessary cast (NFC)

qp is already of uint64_t.
---
 llvm/lib/Support/APInt.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 1547f48bc7ac0..0c0e1d042e75d 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1377,7 +1377,7 @@ static void KnuthDiv(uint32_t *u, uint32_t *v, uint32_t *q, uint32_t* r,
     // the true value, and a "borrow" to the left should be remembered.
     int64_t borrow = 0;
     for (unsigned i = 0; i < n; ++i) {
-      uint64_t p = uint64_t(qp) * uint64_t(v[i]);
+      uint64_t p = qp * uint64_t(v[i]);
       int64_t subres = int64_t(u[j+i]) - borrow - Lo_32(p);
       u[j+i] = Lo_32(subres);
       borrow = Hi_32(p) - Hi_32(subres);



More information about the llvm-commits mailing list