[llvm] Add `visitGEPOfAlloc` to restore the `visitGEPOfBitcast` part of the behavior of non-opaque pointers. (PR #65764)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 20:39:30 PDT 2023


DianQK wrote:

> We definitely shouldn't do this. From the issue, it's not clear where the problem actually is (given lack of reproducer), but I expect that this needs to be solved by teaching some transform to use offset-based reasoning for GEPs (or alternatively, by canonicalizing to i8 GEPs).

Thanks for the reply. I feel like I understand the issue a little better.
I found out earlier that SROA was not canonicalizing all the GEPs to i8 GEPs due to the escaped scene.
Since non-opaque pointers are OK, I incorrectly guessed it was a regression issue. So I didn't look at that part in depth.

I tried a lot of reproducers using llvm-reduce. An LLVM any-version reproducer may not exist. Just lucky in the case of non-opaque pointers.
I can execute inline before any pass. This is a reproducer of LLVM 16 not being able to optimize successfully in either mode.

Do you think bringing ahead GVN to LoopFullUnroll is the right choice? This should provide more optimization opportunities for LoopFullUnroll.

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


More information about the llvm-commits mailing list