[clang] [CIR] Lower __builtin_assume_dereferenceable (PR #197262)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 11:50:01 PDT 2026


================
@@ -1098,6 +1098,18 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
     return RValue::get(nullptr);
   }
 
+  case Builtin::BI__builtin_assume_dereferenceable: {
+    mlir::Value ptrValue = emitScalarExpr(e->getArg(0));
+    mlir::Value sizeValue = emitScalarExpr(e->getArg(1));
+    // The operand bundle expects a pointer-sized integer; widen/narrow to
+    // intptr_t to match classic CodeGen.
+    mlir::Type intPtrTy = convertType(getContext().getIntPtrType());
----------------
adams381 wrote:

Switched to `getUIntPtrType()`.  Also moved this codepath into the bundle redesign -- see Andy's thread below.


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


More information about the cfe-commits mailing list