Skip to content

Commit 08a140a

Browse files
authored
[AArch64] Fix build-bot assertion error in AArch64 (#154124)
Fixes build bot assertion. I forgot to include logic that will be added in a future PR that handles -1 correctly. For now, let's just return nullptr like we used to.
1 parent 1c51886 commit 08a140a

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4035,12 +4035,13 @@ static SDValue getAArch64Cmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
40354035
break;
40364036
case ISD::SETULE:
40374037
case ISD::SETUGT: {
4038-
assert(!C.isAllOnes() && "C should not be -1 here");
4039-
APInt CPlusOne = C + 1;
4040-
if (isLegalCmpImmed(CPlusOne) ||
4041-
(NumImmForC > numberOfInstrToLoadImm(CPlusOne))) {
4042-
CC = (CC == ISD::SETULE) ? ISD::SETULT : ISD::SETUGE;
4043-
RHS = DAG.getConstant(CPlusOne, DL, VT);
4038+
if (!C.isAllOnes()) {
4039+
APInt CPlusOne = C + 1;
4040+
if (isLegalCmpImmed(CPlusOne) ||
4041+
(NumImmForC > numberOfInstrToLoadImm(CPlusOne))) {
4042+
CC = (CC == ISD::SETULE) ? ISD::SETULT : ISD::SETUGE;
4043+
RHS = DAG.getConstant(CPlusOne, DL, VT);
4044+
}
40444045
}
40454046
break;
40464047
}

llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,10 @@ tryAdjustICmpImmAndPred(Register RHS, CmpInst::Predicate P,
639639
// x ule c => x ult c + 1
640640
// x ugt c => s uge c + 1
641641
//
642-
assert(C != (Size == 32 ? UINT32_MAX : UINT64_MAX) &&
643-
"C should not be -1 here!");
642+
// When c is not the largest possible unsigned integer.
643+
if ((Size == 32 && static_cast<uint32_t>(C) == UINT32_MAX) ||
644+
(Size == 64 && C == UINT64_MAX))
645+
return std::nullopt;
644646
P = (P == CmpInst::ICMP_ULE) ? CmpInst::ICMP_ULT : CmpInst::ICMP_UGE;
645647
C += 1;
646648
break;

0 commit comments

Comments
 (0)