[llvm] d222fa4 - TargetInstrInfo: squelch a signedness warning on MSVC (#74078)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 08:08:49 PST 2023


Author: Ramkumar Ramachandra
Date: 2023-12-01T16:08:41Z
New Revision: d222fa4521531cc4ac14b8e157d231c108c003be

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

LOG: TargetInstrInfo: squelch a signedness warning on MSVC (#74078)

Follow up on 9468de4 (TargetInstrInfo: make getOperandLatency return
optional (NFC)) to squelch a signedness warning on MSVC, reported by
Simon Pilgrim.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCInstrItineraries.h
    llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCInstrItineraries.h b/llvm/include/llvm/MC/MCInstrItineraries.h
index b17c41ce3aa4a14..d1c2e788ee8105c 100644
--- a/llvm/include/llvm/MC/MCInstrItineraries.h
+++ b/llvm/include/llvm/MC/MCInstrItineraries.h
@@ -220,7 +220,7 @@ class InstrItineraryData {
       return std::nullopt;
 
     UseCycle = *DefCycle - *UseCycle + 1;
-    if (UseCycle > 0 &&
+    if (UseCycle > 0u &&
         hasPipelineForwarding(DefClass, DefIdx, UseClass, UseIdx))
       // FIXME: This assumes one cycle benefit for every pipeline forwarding.
       UseCycle = *UseCycle - 1;

diff  --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 94f34b127696609..ce65c8e5245b19f 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -4110,7 +4110,7 @@ std::optional<unsigned> ARMBaseInstrInfo::getOperandLatency(
     return std::nullopt;
 
   UseCycle = *DefCycle - *UseCycle + 1;
-  if (UseCycle > 0) {
+  if (UseCycle > 0u) {
     if (LdmBypass) {
       // It's a variable_ops instruction so we can't use DefIdx here. Just use
       // first def operand.


        


More information about the llvm-commits mailing list