We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following C code generates wrong mlir code
int foo(int num) { int sum = 0; int i = 0; for (; i < num; i += 5) { sum += i; } return sum + i; }
func.func @_Z3fooi(%arg0: i32) -> i32 attributes {llvm.linkage = #llvm.linkage<external>} { %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %c0_i32 = arith.constant 0 : i32 %0 = arith.index_cast %arg0 : i32 to index %1 = scf.for %arg1 = %c0 to %0 step %c5 iter_args(%arg2 = %c0_i32) -> (i32) { %3 = arith.index_cast %arg1 : index to i32 %4 = arith.addi %arg2, %3 : i32 scf.yield %4 : i32 } %2 = arith.addi %1, %arg0 : i32 return %2 : i32 }
This instruction %2 = arith.addi %1, %arg0 : i32 is wrong because num is not necessarily a multiple of 5
%2 = arith.addi %1, %arg0 : i32
num
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following C code generates wrong mlir code
This instruction
%2 = arith.addi %1, %arg0 : i32
is wrong becausenum
is not necessarily a multiple of 5The text was updated successfully, but these errors were encountered: