[clang] [CIR] Add support for __builtin_alloca (PR #157116)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 5 11:17:53 PDT 2025


================
@@ -149,6 +149,57 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
     emitVAEnd(emitVAListRef(e->getArg(0)).getPointer());
     return {};
 
+  case Builtin::BIalloca:
+  case Builtin::BI_alloca:
+  case Builtin::BI__builtin_alloca_uninitialized:
+  case Builtin::BI__builtin_alloca: {
+    // Get alloca size input
+    mlir::Value size = emitScalarExpr(e->getArg(0));
+
+    // The alignment of the alloca should correspond to __BIGGEST_ALIGNMENT__.
+    const TargetInfo &TI = getContext().getTargetInfo();
----------------
andykaylor wrote:

```suggestion
    const TargetInfo &ti = getContext().getTargetInfo();
```

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


More information about the cfe-commits mailing list