[llvm] 08a140a - [AArch64] Fix build-bot assertion error in AArch64 (#154124)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 18 08:12:10 PDT 2025
Author: AZero13
Date: 2025-08-18T15:12:07Z
New Revision: 08a140add86081932515188bd9120fd5e69f3ac3
URL: https://github.com/llvm/llvm-project/commit/08a140add86081932515188bd9120fd5e69f3ac3
DIFF: https://github.com/llvm/llvm-project/commit/08a140add86081932515188bd9120fd5e69f3ac3.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index c27bf82157393..63a85faf344c4 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -4035,12 +4035,13 @@ static SDValue getAArch64Cmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
break;
case ISD::SETULE:
case ISD::SETUGT: {
- assert(!C.isAllOnes() && "C should not be -1 here");
- APInt CPlusOne = C + 1;
- if (isLegalCmpImmed(CPlusOne) ||
- (NumImmForC > numberOfInstrToLoadImm(CPlusOne))) {
- CC = (CC == ISD::SETULE) ? ISD::SETULT : ISD::SETUGE;
- RHS = DAG.getConstant(CPlusOne, DL, VT);
+ if (!C.isAllOnes()) {
+ APInt CPlusOne = C + 1;
+ if (isLegalCmpImmed(CPlusOne) ||
+ (NumImmForC > numberOfInstrToLoadImm(CPlusOne))) {
+ CC = (CC == ISD::SETULE) ? ISD::SETULT : ISD::SETUGE;
+ RHS = DAG.getConstant(CPlusOne, DL, VT);
+ }
}
break;
}
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp b/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
index 2abe0dd0bbdc2..6025f1c9f5f4e 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
@@ -639,8 +639,10 @@ tryAdjustICmpImmAndPred(Register RHS, CmpInst::Predicate P,
// x ule c => x ult c + 1
// x ugt c => s uge c + 1
//
- assert(C != (Size == 32 ? UINT32_MAX : UINT64_MAX) &&
- "C should not be -1 here!");
+ // When c is not the largest possible unsigned integer.
+ if ((Size == 32 && static_cast<uint32_t>(C) == UINT32_MAX) ||
+ (Size == 64 && C == UINT64_MAX))
+ return std::nullopt;
P = (P == CmpInst::ICMP_ULE) ? CmpInst::ICMP_ULT : CmpInst::ICMP_UGE;
C += 1;
break;
More information about the llvm-commits
mailing list