Skip to content

Commit 7990a7e

Browse files
committed
[IndVars] Use getSigned() in FP transform
This transform is working on signed integer, so this is the logically correct API. Split off from #80309.
1 parent 4d97ad5 commit 7990a7e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,19 +357,19 @@ bool IndVarSimplify::handleFloatingPointIV(Loop *L, PHINode *PN) {
357357
// Insert new integer induction variable.
358358
PHINode *NewPHI =
359359
PHINode::Create(Int32Ty, 2, PN->getName() + ".int", PN->getIterator());
360-
NewPHI->addIncoming(ConstantInt::get(Int32Ty, InitValue),
360+
NewPHI->addIncoming(ConstantInt::getSigned(Int32Ty, InitValue),
361361
PN->getIncomingBlock(IncomingEdge));
362362
NewPHI->setDebugLoc(PN->getDebugLoc());
363363

364-
Instruction *NewAdd =
365-
BinaryOperator::CreateAdd(NewPHI, ConstantInt::get(Int32Ty, IncValue),
366-
Incr->getName() + ".int", Incr->getIterator());
364+
Instruction *NewAdd = BinaryOperator::CreateAdd(
365+
NewPHI, ConstantInt::getSigned(Int32Ty, IncValue),
366+
Incr->getName() + ".int", Incr->getIterator());
367367
NewAdd->setDebugLoc(Incr->getDebugLoc());
368368
NewPHI->addIncoming(NewAdd, PN->getIncomingBlock(BackEdge));
369369

370-
ICmpInst *NewCompare =
371-
new ICmpInst(TheBr->getIterator(), NewPred, NewAdd,
372-
ConstantInt::get(Int32Ty, ExitValue), Compare->getName());
370+
ICmpInst *NewCompare = new ICmpInst(
371+
TheBr->getIterator(), NewPred, NewAdd,
372+
ConstantInt::getSigned(Int32Ty, ExitValue), Compare->getName());
373373
NewCompare->setDebugLoc(Compare->getDebugLoc());
374374

375375
// In the following deletions, PN may become dead and may be deleted.

0 commit comments

Comments
 (0)