[llvm] [ValueTracking] isNonZero trunc of sub of ptr2int's with recursive GEP where pointers are limited to a 32bit alloc. (PR #84933)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 01:06:38 PDT 2024


dtcxzyw wrote:

> > > Looks like a case where it's better to change the source code to use the correct type instead (size_t instead of unsigned).
> > 
> > 
> > I would agree. However there are scenarios in benchmark applications where source cannot be changed.
> 
> I suspected you were going to say this. This patch very much looks like a hack for the sake of improving some benchmark score, which is something I am not very fond of. Of course, if we can get a clean implementation out of this and show that it benefits non-benchmark code (cc @dtcxzyw), then that's a different matter...

`trunc(sub(ptr2int, ptr2int)) to i32` is a common pattern. But this patch seems to just handle a special case :( I cannot tell whether it provides benefits to some real-world applications.

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


More information about the llvm-commits mailing list