@@ -573,7 +573,7 @@ static SILValue getSub(SILLocation Loc, SILValue Val, unsigned SubVal,
573573 SmallVector<SILValue, 4 > Args (1 , Val);
574574 Args.push_back (B.createIntegerLiteral (Loc, Val->getType (), SubVal));
575575 Args.push_back (B.createIntegerLiteral (
576- Loc, SILType::getBuiltinIntegerType (1 , B.getASTContext ()), - 1 ));
576+ Loc, SILType::getBuiltinIntegerType (1 , B.getASTContext ()), 1 ));
577577
578578 auto *AI = B.createBuiltinBinaryFunctionWithOverflow (
579579 Loc, " ssub_with_overflow" , Args);
@@ -585,7 +585,7 @@ static SILValue getAdd(SILLocation Loc, SILValue Val, unsigned AddVal,
585585 SmallVector<SILValue, 4 > Args (1 , Val);
586586 Args.push_back (B.createIntegerLiteral (Loc, Val->getType (), AddVal));
587587 Args.push_back (B.createIntegerLiteral (
588- Loc, SILType::getBuiltinIntegerType (1 , B.getASTContext ()), - 1 ));
588+ Loc, SILType::getBuiltinIntegerType (1 , B.getASTContext ()), 1 ));
589589
590590 auto *AI = B.createBuiltinBinaryFunctionWithOverflow (
591591 Loc, " sadd_with_overflow" , Args);
@@ -1363,7 +1363,8 @@ BoundsCheckOpts::findAndOptimizeInductionVariables(SILLoop *loop) {
13631363 if (isComparisonKnownTrue (builtin, *ivar)) {
13641364 if (!trueVal)
13651365 trueVal = builder.createIntegerLiteral (builtin->getLoc (),
1366- builtin->getType (), -1 );
1366+ builtin->getType (), -1 ,
1367+ /* treatAsSigned=*/ true );
13671368 builtin->replaceAllUsesWith (trueVal);
13681369 changed = true ;
13691370 continue ;
0 commit comments