)]}'
{
  "commit": "d28b25d3cf54cb87254fb249f7eda2e601d9bb60",
  "tree": "30bde62d577f108d3d8a15eaaab944c9c0b87069",
  "parents": [
    "e162b7c6381b9628f87588fb2e782e6bec216f3d"
  ],
  "author": {
    "name": "adams381",
    "email": "adams@nvidia.com",
    "time": "Thu May 14 13:50:14 2026 -0500"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu May 14 13:50:14 2026 -0500"
  },
  "message": "[CIR] Lower aligned operator new in CIRGen (and matching cleanup-during-new) (#197094)\n\nTwo related `errorNYI`s in CIRGen for C++17 aligned `operator new` /\n`delete`:\n\n- `emitCXXNewExpr` `errorNYI`\u0027d on `\"emitCXXNewExpr: pass alignment\"`\nwhen the allocator is the `align_val_t`-overloaded form (called whenever\nyou `new` an over-aligned type).\n- The cleanup-during-new path (the `CallDeleteDuringNew` cleanup that\nfires if a ctor throws after `operator new` returns) `errorNYI`\u0027d on the\nmatching `\"CallDeleteDuringNew: aligned allocation\"`.\n\nThe non-cleanup delete path was already wired up; this just plumbs the\nmatching new side.\n\nBoth fixes are direct ports of `clang/lib/CodeGen/CGExprCXX.cpp`. In\n`emitCXXNewExpr` we look up the alignment parameter type from the\nallocator prototype (or fall back to `size_t` for the variadic corner\ncase classic also handles), build a constant of that type, and append it\nafter the size argument. The cleanup uses `getSizeType()` for the\nalignment param type per the existing `// FIXME` comment that\u0027s also in\nclassic.\n\nHit this trying to build `706.stockfish_r` from SPEC CPU 2026 with\n`-fclangir` — stockfish allocates over-aligned NNUE state via plain\n`new`. The minimum repro:\n\n```c++\nstruct alignas(64) Big { char data[64]; };\nvoid f() { Big *p \u003d new Big; delete p; }\n```\n\nThe new test cross-checks against OGCG so any drift between the two\nbackends shows up — both emit the same `_ZnwmSt11align_val_t(64, 64)`\nand `_ZdlPvmSt11align_val_t(p, 64, 64)` calls.\n\nA few honest caveats worth flagging:\n\n- The `CallDeleteDuringNew` fix isn\u0027t directly exercised by the test.\nTriggering it needs `-fcxx-exceptions` plus a throwing ctor, and CIR\u0027s\nEH path has its own NYIs that would muddy the test. The cleanup is a 1:1\nmirror of the regular-delete-side fix that already landed and uses the\nsame `getSizeType()` fallback as classic.\n- The variadic `operator new(size_t, ...)` corner case is also untested.\nThe `if (allocatorType-\u003egetNumParams() \u003e paramsToSkip)` branch covers\nthe common case; the else branch falls back to `sizeType` (mirroring\nclassic, which guards the equivalent with\n`assert(allocator-\u003eisVariadic())` and likewise has no test).\n- The cleanup path uses `getSizeType()` for the alignment param type\nrather than the actual `align_val_t` enum, mirroring the existing `//\nFIXME` in classic. ABI-equivalent — `align_val_t`\u0027s underlying type is\n`size_t` — but the IR type label differs.\n\nBoth CIR test suites pass cleanly (`check-clang-cir-codegen` 325/326 + 1\nunsupported, `check-clang-cir` 718/729 + 1 XFAIL + 10 unsupported).",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "646fc7eb3c226d92128219503f5e7dcde2a2f879",
      "old_mode": 33188,
      "old_path": "clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h",
      "new_id": "3df3c0da502d997f75c41cee60253caa889822cd",
      "new_mode": 33188,
      "new_path": "clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h"
    },
    {
      "type": "modify",
      "old_id": "752a1d3e6e2206b7425ed0e0475c564ef770c83f",
      "old_mode": 33188,
      "old_path": "clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp",
      "new_id": "b680d4f092297bfb5f48100d81d41972971f32df",
      "new_mode": 33188,
      "new_path": "clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "289a2b97a8a065513d2d6c467581a1d9be803f24",
      "new_mode": 33188,
      "new_path": "clang/test/CIR/CodeGen/aligned-allocation.cpp"
    }
  ]
}
