diff --git a/llvm/lib/CheerpWriter/CheerpWriter.cpp b/llvm/lib/CheerpWriter/CheerpWriter.cpp index 66bd1a4dc304..02fd4f5fa712 100644 --- a/llvm/lib/CheerpWriter/CheerpWriter.cpp +++ b/llvm/lib/CheerpWriter/CheerpWriter.cpp @@ -1653,8 +1653,10 @@ void CheerpWriter::compileEqualPointersComparison(const llvm::Value* lhs, const // NOTE: For any pointer-to-immutable, converting to CO is actually a dereference. (base[offset] in both cases) // PA enforces that comparisons between pointers-to-immutable (which include pointers-to-pointers) // need a SPLIT_REGULAR kind. Make sure to also use SPLIT_REGULAR if one kind is CONSTANT (e.g. null) - else if((lhsKind == REGULAR || lhsKind == SPLIT_REGULAR || lhsKind == RAW ||lhsKind == CONSTANT || (isGEP(lhs) && cast(lhs)->getNumOperands()==2)) && - (rhsKind == REGULAR || rhsKind == SPLIT_REGULAR || rhsKind == RAW ||rhsKind == CONSTANT || (isGEP(rhs) && cast(rhs)->getNumOperands()==2))) + else if ((lhsKind == REGULAR || lhsKind == SPLIT_REGULAR || lhsKind == RAW ||lhsKind == CONSTANT || + (isGEP(lhs) && (cast(lhs)->getNumOperands()==2 || getGEPContainerType(cast(lhs))->isArrayTy() || getGEPContainerType(cast(lhs))->isPointerTy()))) && + (rhsKind == REGULAR || rhsKind == SPLIT_REGULAR || rhsKind == RAW ||rhsKind == CONSTANT || + (isGEP(rhs) && (cast(rhs)->getNumOperands()==2 || getGEPContainerType(cast(rhs))->isArrayTy() || getGEPContainerType(cast(rhs))->isPointerTy())))) { assert(lhsKind != COMPLETE_OBJECT || !isa(lhs) || isInlineable(*cast(lhs), PA));