[llvm] 9ba438d - [RISCV] Remove some unnecessary casts from int64_t to uint64_t. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 10:10:30 PST 2025


Author: Craig Topper
Date: 2025-02-20T10:10:14-08:00
New Revision: 9ba438d3217505c48a7b9fb4cbe75ab9e055093f

URL: https://github.com/llvm/llvm-project/commit/9ba438d3217505c48a7b9fb4cbe75ab9e055093f
DIFF: https://github.com/llvm/llvm-project/commit/9ba438d3217505c48a7b9fb4cbe75ab9e055093f.diff

LOG: [RISCV] Remove some unnecessary casts from int64_t to uint64_t. NFC

We have a lot of casts near this to avoid undefined behavior or
arithmetic on arbitrary signed integers, but the casts removed here
don't appear to be necessary.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
index 06ae8e1296e51..e40c85abc8b5d 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
@@ -134,7 +134,7 @@ static void generateInstSeqImpl(int64_t Val, const MCSubtargetInfo &STI,
     }
 
     // Try to use SLLI_UW for Val when it is uint32 but not int32.
-    if (isUInt<32>((uint64_t)Val) && !isInt<32>((uint64_t)Val) &&
+    if (isUInt<32>(Val) && !isInt<32>(Val) &&
         STI.hasFeature(RISCV::FeatureStdExtZba)) {
       // Use LUI+ADDI or LUI to compose, then clear the upper 32 bits with
       // SLLI_UW.


        


More information about the llvm-commits mailing list