Skip to content

TargetInstrInfo: squelch a signedness warning on MSVC #74078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

artagnon
Copy link
Contributor

@artagnon artagnon commented Dec 1, 2023

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

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

llvmbot commented Dec 1, 2023

@llvm/pr-subscribers-backend-arm

Author: Ramkumar Ramachandra (artagnon)

Changes

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


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

2 Files Affected:

  • (modified) llvm/include/llvm/MC/MCInstrItineraries.h (+1-1)
  • (modified) llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp (+1-1)
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.

@RKSimon
Copy link
Collaborator

RKSimon commented Dec 1, 2023

This will help, but there are a LOT of these warnings in other files - I don't have the time to address these right now. Ideally you'd be able to find a buildbot that lists them in the build stdout (and not just the header line)

@RKSimon
Copy link
Collaborator

RKSimon commented Dec 1, 2023

Actually https://lab.llvm.org/buildbot/#/builders/216/builds/31206/steps/6/logs/stdio should give you a more complete list

@artagnon
Copy link
Contributor Author

artagnon commented Dec 1, 2023

Thanks. I looked at the build log, and all the warnings are coming from including MCInstrItineraries.h, and the warning is on line 223, which I've fixed.

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a first pass

@artagnon artagnon merged commit d222fa4 into llvm:main Dec 1, 2023
@artagnon artagnon deleted the sign-fix-msvc branch December 1, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants