[llvm-dev] Identify Array Accesses from LLVM's IR

Chatterjee, Bodhisatwa via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 15 22:23:37 PDT 2019


Hi,

I am trying to identify instructions which are array accesses in my source code.
For example, something like:

 for (int i = 1; i < 10; i++)
   {
       A[i] = 5;
       B[i] = A[i-1];
   }

would be transformed to:
  %1 = load i32, i32* %i, align 4
  store i32 5, i32* %arrayidx, align 4
  %2 = load i32, i32* %i, align 4
  %3 = load i32, i32* %arrayidx2, align 4
  %4 = load i32, i32* %i, align 4
  store i32 %3, i32* %arrayidx4, align 4

Is it possible for me to somehow separate out the part of IRs which have 'arrayidx's which would allow me to identify array accesses in my source code?

Thanks,
Bodhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/52c837f2/attachment.html>


More information about the llvm-dev mailing list