Skip to content

Fix build warning caused by mixed signed/unsigned compare #69797

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 3 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ bool SimplifyIndvar::replaceFloatIVWithIntegerIV(Instruction *UseInst) {
Instruction *IVOperand = cast<Instruction>(UseInst->getOperand(0));
// Get the symbolic expression for this instruction.
const SCEV *IV = SE->getSCEV(IVOperand);
unsigned MaskBits;
int MaskBits;
if (UseInst->getOpcode() == CastInst::SIToFP)
MaskBits = SE->getSignedRange(IV).getMinSignedBits();
MaskBits = (int)SE->getSignedRange(IV).getMinSignedBits();
else
MaskBits = SE->getUnsignedRange(IV).getActiveBits();
MaskBits = (int)SE->getUnsignedRange(IV).getActiveBits();
int DestNumSigBits = UseInst->getType()->getFPMantissaWidth();
if (MaskBits <= DestNumSigBits) {
for (User *U : UseInst->users()) {
Expand Down