[Mlir-commits] [mlir] [mlir][Affine] Add nuw/nsw to lowering of affine ops. (PR #121535)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jan 3 17:10:01 PST 2025


MaheshRavishankar wrote:

> Sadly, I don't think this change is correct. If it is correct.
> 
> That being said, I think that the broader point about overflows has something to it. I claim that all the additions and multiplications in an affine map (and so also in `AffineExpandIndexOps.cpp` and the other utilities) are `nsw` - assuming we document this - because the result of any operation is guaranteed not to wrap `index` in a signed way (for whatever the eventual width of `index` is)
> 
> Now, `nsw && [proof of non-negativity] => nuw`, but I don't think that can be done at this stage of codegen.

Fair point... I am actually these changes a bit... for now I am just going to add nsw to `muli` operations and come back and add nsw to `addi` operations

https://github.com/llvm/llvm-project/pull/121535


More information about the Mlir-commits mailing list