[llvm] 77523f9 - [LoongArch] Remove unnecessary increment operations

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 1 20:19:06 PDT 2024


Author: wanglei
Date: 2024-09-02T11:07:30+08:00
New Revision: 77523f9d5f7eac860a39728f031e3db9a53ee3b6

URL: https://github.com/llvm/llvm-project/commit/77523f9d5f7eac860a39728f031e3db9a53ee3b6
DIFF: https://github.com/llvm/llvm-project/commit/77523f9d5f7eac860a39728f031e3db9a53ee3b6.diff

LOG: [LoongArch] Remove unnecessary increment operations

`HighMask` is the value that sets bits from `Msb+1` to 63 to 1, while
the other bits are set to 0.

Added: 
    

Modified: 
    llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp
index 08e5ccc7bc0be5..6343817a0616d1 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp
@@ -94,7 +94,7 @@ LoongArchMatInt::InstSeq LoongArchMatInt::generateInstSeq(int64_t Val) {
 
   uint64_t Msb = 32;
   uint64_t HighMask = ~((1ULL << (Msb + 1)) - 1);
-  for (; Msb < 64; ++Msb, HighMask = (HighMask << 1) + 1) {
+  for (; Msb < 64; ++Msb, HighMask = HighMask << 1) {
     for (uint64_t Lsb = Msb; Lsb > 0; --Lsb) {
       uint64_t LowMask = (1ULL << Lsb) - 1;
       uint64_t Mask = HighMask | LowMask;


        


More information about the llvm-commits mailing list