================ ---------------- rengolin wrote: This code looks almost identical (modulo indices). Can you select the indices based on `dimCount` and then have the code done once? https://github.com/llvm/llvm-project/pull/163382