[llvm] b0225ab - Prevent comparison with wider type in loop condition

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 04:35:31 PDT 2022


Author: Aakanksha
Date: 2022-03-25T11:35:18Z
New Revision: b0225ab8fd4fff92f081da3fabcb635c8e67e5ca

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

LOG: Prevent comparison with wider type in loop condition

This change fixes the code violations flagged in AMD compute CodeQL scan - "comparison-with-wider-type"

Differential Revision: https://reviews.llvm.org/D122447

Added: 
    

Modified: 
    llvm/utils/TableGen/X86RecognizableInstr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/X86RecognizableInstr.cpp b/llvm/utils/TableGen/X86RecognizableInstr.cpp
index ae01014ddd235..1ae90d888a7dc 100644
--- a/llvm/utils/TableGen/X86RecognizableInstr.cpp
+++ b/llvm/utils/TableGen/X86RecognizableInstr.cpp
@@ -840,8 +840,8 @@ void RecognizableInstr::emitDecodePath(DisassemblerTables &tables) const {
 
     uint8_t currentOpcode;
 
-    for (currentOpcode = opcodeToSet; currentOpcode < opcodeToSet + Count;
-         ++currentOpcode)
+    for (currentOpcode = opcodeToSet;
+         currentOpcode < (uint8_t)(opcodeToSet + Count); ++currentOpcode)
       tables.setTableFields(*opcodeType, insnContext(), currentOpcode, *filter,
                             UID, Is32Bit, OpPrefix == 0,
                             IgnoresVEX_L || EncodeRC,


        


More information about the llvm-commits mailing list