[clang] [CIR] Upstream ThreeWayCmpOp (PR #169963)
Hendrik Hübner via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 15 15:56:46 PST 2026
================
@@ -298,8 +299,63 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> {
Visit(e->getRHS());
}
void VisitBinCmp(const BinaryOperator *e) {
- cgf.cgm.errorNYI(e->getSourceRange(), "AggExprEmitter: VisitBinCmp");
+ assert(cgf.getContext().hasSameType(e->getLHS()->getType(),
+ e->getRHS()->getType()));
+ const ComparisonCategoryInfo &cmpInfo =
+ cgf.getContext().CompCategories.getInfoForType(e->getType());
+ assert(cmpInfo.Record->isTriviallyCopyable() &&
+ "cannot copy non-trivially copyable aggregate");
+
+ QualType argTy = e->getLHS()->getType();
+
+ if (!argTy->isIntegralOrEnumerationType() && !argTy->isRealFloatingType() &&
+ !argTy->isNullPtrType() && !argTy->isPointerType() &&
+ !argTy->isMemberPointerType() && !argTy->isAnyComplexType())
+ llvm_unreachable("aggregate three-way comparison");
+
+ mlir::Location loc = cgf.getLoc(e->getSourceRange());
+ CIRGenBuilderTy builder = cgf.getBuilder();
+
+ if (e->getType()->isAnyComplexType())
----------------
HendrikHuebner wrote:
Yes, good catch.
https://github.com/llvm/llvm-project/pull/169963
More information about the cfe-commits
mailing list