https://github.com/joker-eph commented: We need a test for this, can you add one? I'm also not sure this is the right fix, it does not build the same expression, but maybe some CSE is already done on the AffineExpr later anyway? https://github.com/llvm/llvm-project/pull/168175