[llvm] Fix build break when building RISCVInstrInfo.cpp with MSVC (PR #110342)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 16:52:13 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Daniel Paoliello (dpaoliello)

<details>
<summary>Changes</summary>

After #<!-- -->109774 MSVC is failing to build LLVM with the error:

```
llvm\lib\Target\RISCV\RISCVInstrInfo.cpp(782): warning C4018: '<': signed/unsigned mismatch
```

Fix is ensure that the RHS is an unsigned integer.

---
Full diff: https://github.com/llvm/llvm-project/pull/110342.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/RISCVInstrInfo.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index f0295d289ed86a..529944044f02d2 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -779,7 +779,7 @@ MachineInstr *RISCVInstrInfo::foldMemoryOperandImpl(
     if (RISCV::getRVVMCOpcode(MI.getOpcode()) == RISCV::VMV_X_S) {
       unsigned Log2SEW =
           MI.getOperand(RISCVII::getSEWOpNum(MI.getDesc())).getImm();
-      if (STI.getXLen() < (1 << Log2SEW))
+      if (STI.getXLen() < (1U << Log2SEW))
         return nullptr;
       switch (Log2SEW) {
       case 3:

``````````

</details>


https://github.com/llvm/llvm-project/pull/110342


More information about the llvm-commits mailing list