)]}'
{
  "commit": "175f034ac0c9a543ace1c029c78b25fd82e93703",
  "tree": "a855a25958d1ea2553b07cc6ad26a6b67af9d362",
  "parents": [
    "13d9ad9501d878ff61ca1a0f753419f6d78ce85c"
  ],
  "author": {
    "name": "pstarkcdpr",
    "email": "paul.stark@cdprojektred.com",
    "time": "Wed Aug 05 23:14:37 2026 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Aug 06 06:14:37 2026 +0000"
  },
  "message": "Fix out-of-bounds crash in Stream affinity analysis for scf.while (#24723)\n\nSee issue https://github.com/iree-org/iree/issues/24722\n\nThe issue contains a deeper explanation of the issue and a repro case\n(which is the same as the lit test here).\n\nWhen an `scf.while` carries more values through its \"before\" region than\nthe op has results (i.e. some loop-carried values are not forwarded to a\nresult via `scf.condition`), the affinity analysis mapped an `scf.yield`\noperand number directly onto `whileOp-\u003egetResult(operandNumber)`. Since\nthe \"after\" region yield has one operand per init operand (`N`) while\nthe op may have fewer results (`M`), this lead to `getResult()` being\nout of bounds.\n\nTwo independent sites made this naive mapping:\n\n- **`Affinity.cpp`**: in the `scf.yield` → `scf.while` branch of\n`ValueConsumerAffinityPVS::updateFromUse`, drop the\n`whileOp-\u003egetResult(operandNumber)` propagation and keep only the\nbefore-region-argument propagation. (Results are already handled by the\n`scf.condition` case.)\n\n- **`Explorer.cpp`**: guard the `ReturnLike` result-mapping fallback in\n`walkTransitiveUses` with\n`!isa\u003cRegionBranchTerminatorOpInterface\u003e(ownerOp)` (region-branch\nterminators like `scf.yield` are already handled correctly above) plus a\n`use.getOperandNumber() \u003c parent-\u003egetNumResults()` bounds check.\n\nAdded regression test `@scf_while_extra_loop_carried`, which exercises\nthe `N \u003e M` shape (two loop-carried values, one result) that previously\nasserted.\n\nNote that Claude made the fix suggestions and, while they look okay to\nme, I\u0027m not at all familiar with this code.\n\n---------\n\nSigned-off-by: Paul Stark \u003cpaul.stark@cdprojektred.com\u003e\nCo-authored-by: Claude Opus 4.8 (1M context) \u003cnoreply@anthropic.com\u003e\nCo-authored-by: Artem Gindinson \u003cgindinson@roofline.ai\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a1ea379faa556f551fea20e9d6f024dff61e7477",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Stream/Analysis/Affinity.cpp",
      "new_id": "59834178da56189c90bf5924229f8102884066cc",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Stream/Analysis/Affinity.cpp"
    },
    {
      "type": "modify",
      "old_id": "f73cfff3acb617182b47d22a7b07cb92b0b06283",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Stream/Transforms/test/annotate_affinities.mlir",
      "new_id": "40ba7030510eacdc5d702a48cf5be4a4ecfe2d2a",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Stream/Transforms/test/annotate_affinities.mlir"
    },
    {
      "type": "modify",
      "old_id": "9c52400b98a33529aa61f022479c2e32183388df",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Util/Analysis/Explorer.cpp",
      "new_id": "9b921c25d0b8a83914ef7bf665be54e64dffb7c7",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Util/Analysis/Explorer.cpp"
    }
  ]
}
