[llvm] 0d51c87 - [X86] Fix -Wsign-compare in X86MCInstLower.cpp (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 06:38:59 PST 2024


Author: Jie Fu
Date: 2024-01-19T22:38:47+08:00
New Revision: 0d51c8704c647e3eec833b1435d268d8bb693b4e

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

LOG: [X86] Fix -Wsign-compare in X86MCInstLower.cpp (NFC)

llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:1867:20:
 error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
      if (SclWidth == C->getType()->getScalarSizeInBits()) {
          ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86MCInstLower.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index fe3d16a949342bc..6e8e5123369973e 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -1864,7 +1864,7 @@ static void addConstantComments(const MachineInstr *MI,
 
     if (auto *C =
             X86::getConstantFromPool(*MI, MI->getOperand(1 + X86::AddrDisp))) {
-      if (SclWidth == C->getType()->getScalarSizeInBits()) {
+      if ((unsigned)SclWidth == C->getType()->getScalarSizeInBits()) {
         if (auto *CI = dyn_cast<ConstantInt>(C)) {
           CS << "[";
           printConstant(CI->getValue(), CS);


        


More information about the llvm-commits mailing list