Kuree wrote: I think there are a few places in SCF dialect that move operations in the fold function. I can take a look and fix them in separate PRs. @matthias-springer thanks for the approval. Would you please help me merge this in? https://github.com/llvm/llvm-project/pull/98680