)]}'
{
  "commit": "0d0d2d2e62d26be67366babef2ef39ceb62fa878",
  "tree": "189535a2a3a6c2a91831377a85bddf900c30151a",
  "parents": [
    "10f73619936fcf6fe94c8235a32060cb43309d41"
  ],
  "author": {
    "name": "jonathansong",
    "email": "jonathansong45@yahoo.com",
    "time": "Tue Oct 20 10:17:31 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Oct 20 10:17:31 2026 +0200"
  },
  "message": "[Util] Ensure scf.index_switch ops share the same selector before merging (#25037)\n\n`MergeIndexSwitchPattern` merges adjacent `scf.index_switch` operations\nwhen their case values match, but it fails to verify that both ops\nswitch on the same condition operand (selector). Consequently, the\nmerged operation retains only the first op\u0027s selector, causing the\nsecond op\u0027s regions to execute based on the wrong value.\n\n### Minimal reproducer\n\nRun with `iree-opt --iree-util-apply-patterns\n--allow-unregistered-dialect`:\n\n```mlir\nutil.func @f(%case0: index, %case1: index) -\u003e (i32, i32) {\n  %result0 \u003d scf.index_switch %case0 -\u003e i32\n  case 0 { %v \u003d \"some.op0.case0\"() : () -\u003e i32\n           scf.yield %v : i32 }\n  case 1 { %v \u003d \"some.op0.case1\"() : () -\u003e i32\n           scf.yield %v : i32 }\n  default { %v \u003d \"some.op0.default\"() : () -\u003e i32\n            scf.yield %v : i32 }\n  %result1 \u003d scf.index_switch %case1 -\u003e i32\n  case 0 { %v \u003d \"some.op1.case0\"() : () -\u003e i32\n           scf.yield %v : i32 }\n  case 1 { %v \u003d \"some.op1.case1\"() : () -\u003e i32\n           scf.yield %v : i32 }\n  default { %v \u003d \"some.op1.default\"() : () -\u003e i32\n            scf.yield %v : i32 }\n  util.return %result0, %result1 : i32, i32\n}\n```\n\nPrior to this fix, the pattern collapses both into a single\n`scf.index_switch %case0 -\u003e i32, i32`, silently discarding `%case1`.\n\n### Changes\n\n- Require matching selector operands in `MergeIndexSwitchPattern` before\nmerging.\n- Add a negative test case to\n`Dialect/Util/Transforms/test/patterns.mlir` to ensure distinct\nselectors prevent merging.\n\nAssisted-by: Claude Code\n\nSigned-off-by: jonathansong \u003c7958352+jonathansong@users.noreply.github.com\u003e\nCo-authored-by: jonathansong \u003c7958352+jonathansong@users.noreply.github.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "94557c920f9db4853942f96baa824a4e0245970e",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Util/Transforms/Patterns.cpp",
      "new_id": "50541cae5256abb4270ba3e58134c8a7f899af3c",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Util/Transforms/Patterns.cpp"
    },
    {
      "type": "modify",
      "old_id": "becfa2ad74ca458e3acdba76940bfdf0404d8f96",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Util/Transforms/test/patterns.mlir",
      "new_id": "26b2b37592e957f53905f731149c2316cf18dac0",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Util/Transforms/test/patterns.mlir"
    }
  ]
}
