After some reading and experimentation I found out that a helper function
from ValueTracking.h
GetPointerBaseWithConstantOffset(LI->getPointerOperand(), LIOffs, TD);
gives me the desired output. If you have more info on the query please
jump in. Will it work every single time or there are some corner cases.
Thanks! Manish
On Tue, May 26, 2015 at 4:17 PM, Manish Gupta <manishg at cs.ucsd.edu>
wrote:
> Dear All,
>
> For a LoadInst that looks like this:
>
> %23 = load double* getelementptr inbounds ([3 x [3 x double]]* @_ZL2kx,
> i64 0, i64 1, i64 2), align 8, !tbaa !0
>
> How can I know the pointer element used in LoadInst? For this case
> "@_ZL2kx"
>
> I tried using Li->getPointerOperand() and I tried casting the pointer
> operator to GEPInst, but it doesn't seem to work. Let me know if you
have
> any hints on this.
>
> Thanks!
> Manish
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150526/6a89c9d8/attachment.html>