[llvm] [Utils] Remove an unnecessary cast (NFC) (PR #156813)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 23:27:43 PDT 2025


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

getZExtValue() already return uint64_t.


>From 853e08d09307038e91256f7dbe0e02b1e344e587 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 3 Sep 2025 08:44:09 -0700
Subject: [PATCH] [Utils] Remove an unnecessary cast (NFC)

getZExtValue() already return uint64_t.
---
 llvm/lib/Transforms/Utils/Local.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index b94ed7db91580..2cfd70a1746c8 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -3397,8 +3397,8 @@ DIExpression *llvm::getExpressionForConstant(DIBuilder &DIB, const Constant &C,
   if (FP && Ty.isFloatingPointTy() && Ty.getScalarSizeInBits() <= 64) {
     const APFloat &APF = FP->getValueAPF();
     APInt const &API = APF.bitcastToAPInt();
-    if (auto Temp = API.getZExtValue())
-      return DIB.createConstantValueExpression(static_cast<uint64_t>(Temp));
+    if (uint64_t Temp = API.getZExtValue())
+      return DIB.createConstantValueExpression(Temp);
     return DIB.createConstantValueExpression(*API.getRawData());
   }
 



More information about the llvm-commits mailing list