[clang] [CIR] Add BinOpOverflowOp and basic pointer arithmetic support (PR #133118)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 26 14:39:02 PDT 2025


================
@@ -1402,3 +1501,23 @@ mlir::Value CIRGenFunction::emitScalarPrePostIncDec(const UnaryOperator *e,
   return ScalarExprEmitter(*this, builder)
       .emitScalarPrePostIncDec(e, lv, isInc, isPre);
 }
+
+mlir::Value CIRGenFunction::emitCheckedInBoundsGEP(
+    mlir::Type elemTy, mlir::Value ptr, ArrayRef<mlir::Value> idxList,
+    bool signedIndices, bool isSubtraction, SourceLocation loc) {
+  assert(!cir::MissingFeatures::ptrStrideOp());
+  if (idxList.size() != 1)
+    cgm.errorNYI("multi-index ptr arithmetic");
+
+  // TODO(cir): This should be a PtrStrideOp. For now we simply return the base
+  // pointer
+  mlir::Value gepVal = ptr;
----------------
andykaylor wrote:

It seems like we should be emitting an NYI error here.

https://github.com/llvm/llvm-project/pull/133118


More information about the cfe-commits mailing list