[llvm] Decompose gep of complex type struct to its element type (PR #107848)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 01:11:28 PDT 2024


nikic wrote:

> hi, nikic, thanks for your comment.
> 
>     1. For the 1st point, can I add  **OneUse** to avoid that issue you mentioned?
> 
>     2. For the 2nd point, It seems similar to pr96606, so do you mean that we should also driven by **GEP.getSourceElementType()**, but not the **GEP.getResultElementType()** ?

If you're referencing PRs, please use a proper link and don't make me reassemble the URL by hand: #96606 

That PR does something very reasonable, which is to convert the GEP into ptradd representation if this allows merging some of the offset arithmetic. It leaves behind *only* explicit offset arithmetic, not a mix of offset arithmetic and GEP scaling. Basically, the end result for your case would be an i8 GEP with `sext (a<<3)` rather than a float GEP with `sext (a << 1)`.

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


More information about the llvm-commits mailing list