hazzlim wrote:

> > adding nuw is also valid for signed indices here
> 
> I don't understand how you think this would work; a-1 and a+-1 are required 
> to produce the same result.

The thinking here RE signed indices was that in this special case, where the 
base address of the GEP is the start of an array, the index cannot be negative 
without violating the `inbounds` attribute (alternatively the requirement of a 
pointer arithmetic expression to evaluate to an element of the array or one 
past the end, in C/C++ standard terms). Therefore we could prove `nuw` via 
`inbounds` + `nneg`.

I wonder if others agree that this is valid or can see an issue with this?

https://github.com/llvm/llvm-project/pull/103088
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to