[llvm] [IR] Remove an unnecessary cast (NFC) (PR #146381)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 09:16:04 PDT 2025


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

C is already of unsigned char.


>From c7d0747db112b0a9ca122804ee9b884b97c76e4f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 29 Jun 2025 12:22:21 -0700
Subject: [PATCH] [IR] Remove an unnecessary cast (NFC)

C is already of unsigned char.
---
 llvm/lib/IR/AsmWriter.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index ff45afe399c82..af268b4fc6941 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -447,8 +447,7 @@ void llvm::printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name) {
       // in the range 0-255.  This is important when building with MSVC because
       // its implementation will assert.  This situation can arise when dealing
       // with UTF-8 multibyte characters.
-      if (!isalnum(static_cast<unsigned char>(C)) && C != '-' && C != '.' &&
-          C != '_') {
+      if (!isalnum(C) && C != '-' && C != '.' && C != '_') {
         NeedsQuotes = true;
         break;
       }



More information about the llvm-commits mailing list