[MLIR][SCCP] Fix in-place folds leaking into IR during simulation (#213933) SparseConstantPropagation restored the operation only when `fold` did not return any fold results. But a folder can mutate the op in place and still return out-of-place results or fail, e.g. `vector.extract` folds constant dynamic positions into static ones before attempting further folds. The constants fed to `fold` are speculative lattice values, so the mutation bakes a possibly-wrong constant into the IR. SCCP would permanently replace a loop-carried dynamic index with its first lattice value for example. Fix: Restore the original operands and attributes after every fold call, regardless of its outcome. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> GitOrigin-RevId: dce57cf279d65b0ce871a77f1b493e5141a99379
See https://mlir.llvm.org/ for more information.