mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Treat -1 as signed when using it to construct an "all bits set" llvm::APInt
This should enable us to revert
73c70ee338.
This commit is contained in:
@@ -304,7 +304,8 @@ static SILValue createValueForEdge(SILInstruction *UserInst,
|
||||
|
||||
if (auto *CBI = dyn_cast<CondBranchInst>(DominatingTerminator))
|
||||
return Builder.createIntegerLiteral(
|
||||
CBI->getLoc(), CBI->getCondition()->getType(), EdgeIdx == 0 ? -1 : 0);
|
||||
CBI->getLoc(), CBI->getCondition()->getType(), EdgeIdx == 0 ? -1 : 0,
|
||||
/*treatAsSigned=*/true);
|
||||
|
||||
auto *SEI = cast<SwitchEnumInst>(DominatingTerminator);
|
||||
auto *DstBlock = SEI->getSuccessors()[EdgeIdx].getBB();
|
||||
@@ -1480,7 +1481,8 @@ static SILValue invertExpectAndApplyTo(SILBuilder &Builder,
|
||||
if (!IL)
|
||||
return V;
|
||||
SILValue NegatedExpectedValue = Builder.createIntegerLiteral(
|
||||
IL->getLoc(), Args[1]->getType(), IL->getValue() == 0 ? -1 : 0);
|
||||
IL->getLoc(), Args[1]->getType(), IL->getValue() == 0 ? -1 : 0,
|
||||
/*treatAsSigned=*/true);
|
||||
return Builder.createBuiltin(BI->getLoc(), BI->getName(), BI->getType(), {},
|
||||
{V, NegatedExpectedValue});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user