LoadInst getPointerOperand()

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

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