Consider (https://godbolt.org/z/a4r55zdEd):
module @test {
func.func @main() {
cf.br ^bb4
^bb1(%2: i64):
cf.br ^bb4
^bb3:
%c1_i64_3 = arith.constant 1 : i64
%9 = arith.addi %2, %c1_i64_3 : i64
cf.br ^bb1(%9 : i64)
^bb4:
return
}
}
Attempting to canonicalise this with mlir-opt --canonicalize loops for ever; when I was running this in the debugger earlier before reducing it and dumped the add, it printed %7 = arith.addi %7, %c1_i64_3 : i64; so something doesn’t seem right here...