@@ -709,6 +709,7 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
709
709
#undef HANDLEBINOP
710
710
711
711
mlir::Value emitCmp (const BinaryOperator *e) {
712
+ const mlir::Location loc = cgf.getLoc (e->getExprLoc ());
712
713
mlir::Value result;
713
714
QualType lhsTy = e->getLHS ()->getType ();
714
715
QualType rhsTy = e->getRHS ()->getType ();
@@ -734,44 +735,39 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
734
735
};
735
736
736
737
if (lhsTy->getAs <MemberPointerType>()) {
738
+ assert (!cir::MissingFeatures::dataMemberType ());
737
739
assert (e->getOpcode () == BO_EQ || e->getOpcode () == BO_NE);
738
740
mlir::Value lhs = cgf.emitScalarExpr (e->getLHS ());
739
741
mlir::Value rhs = cgf.emitScalarExpr (e->getRHS ());
740
742
cir::CmpOpKind kind = clangCmpToCIRCmp (e->getOpcode ());
741
- result =
742
- builder.createCompare (cgf.getLoc (e->getExprLoc ()), kind, lhs, rhs);
743
+ result = builder.createCompare (loc, kind, lhs, rhs);
743
744
} else if (!lhsTy->isAnyComplexType () && !rhsTy->isAnyComplexType ()) {
744
745
BinOpInfo boInfo = emitBinOps (e);
745
746
mlir::Value lhs = boInfo.lhs ;
746
747
mlir::Value rhs = boInfo.rhs ;
747
748
748
749
if (lhsTy->isVectorType ()) {
749
750
assert (!cir::MissingFeatures::vectorType ());
750
- cgf.cgm .errorNYI (boInfo. loc , " vector comparisons" );
751
- result = builder.getBool (false , cgf. getLoc (boInfo. loc ) );
751
+ cgf.cgm .errorNYI (loc, " vector comparisons" );
752
+ result = builder.getBool (false , loc);
752
753
} else if (boInfo.isFixedPointOp ()) {
753
754
assert (!cir::MissingFeatures::fixedPointType ());
754
- cgf.cgm .errorNYI (boInfo.loc , " fixed point comparisons" );
755
- result = builder.getBool (false , cgf.getLoc (boInfo.loc ));
756
- } else if (lhsTy->hasSignedIntegerRepresentation ()) {
757
- cir::CmpOpKind kind = clangCmpToCIRCmp (e->getOpcode ());
758
- result = builder.createCompare (cgf.getLoc (boInfo.loc ), kind, lhs, rhs);
755
+ cgf.cgm .errorNYI (loc, " fixed point comparisons" );
756
+ result = builder.getBool (false , loc);
759
757
} else {
760
758
// Unsigned integers and pointers.
761
759
if (cgf.cgm .getCodeGenOpts ().StrictVTablePointers &&
762
760
mlir::isa<cir::PointerType>(lhs.getType ()) &&
763
761
mlir::isa<cir::PointerType>(rhs.getType ())) {
764
- cgf.cgm .errorNYI (boInfo.loc , " strict vtable pointer comparisons" );
765
- result = builder.getBool (false , cgf.getLoc (boInfo.loc ));
762
+ cgf.cgm .errorNYI (loc, " strict vtable pointer comparisons" );
766
763
}
767
764
768
765
cir::CmpOpKind kind = clangCmpToCIRCmp (e->getOpcode ());
769
- result = builder.createCompare (cgf. getLoc (boInfo. loc ) , kind, lhs, rhs);
766
+ result = builder.createCompare (loc, kind, lhs, rhs);
770
767
}
771
768
} else {
772
769
// Complex Comparison: can only be an equality comparison.
773
770
assert (!cir::MissingFeatures::complexType ());
774
- const mlir::Location loc = cgf.getLoc (e->getSourceRange ());
775
771
cgf.cgm .errorNYI (loc, " complex comparison" );
776
772
result = builder.getBool (false , loc);
777
773
}
0 commit comments