[llvm-dev] Differentiate array access at IR level (original) (raw)

Michael Meng via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 18 17:16:43 PST 2020


Hi Michael,

Thanks for your reply!

Since I want to collect the counts of unique array access to array elements in one iteration, so I consider a[i] and a[i - 1] as two accesses to different array elements. Would it be possible to get the notion of "i - 1" at IR level.

The IR looks like:

%11 = load float*, float** %a.addr, align 8, !dbg !954 %12 = load i32, i32* %i, align 4, !dbg !955 %sub = sub nsw i32 %12, 1, !dbg !956 %idxprom7 = sext i32 %sub to i64, !dbg !954 %arrayidx8 = getelementptr inbounds float, float* %11, i64 %idxprom7, !dbg !954

Working the the source level might be easier, but I wonder if it is possible to know idxprom7 -> i - 1 with IR

Thanks again! Michael


From: Michael Kruse <llvmdev at meinersbur.de> Sent: Tuesday, February 18, 2020 9:26 AM To: Michael Meng <overrainbow2013 at hotmail.com> Cc: via llvm-dev <llvm-dev at lists.llvm.org> Subject: Re: [llvm-dev] Differentiate array access at IR level

Note that a[i] are a[i-1] are accessing the same memory addresses, just not in the same loop iteration. You may want to look into DependenceInfo.

Michael

Am Mo., 17. Feb. 2020 um 00:04 Uhr schrieb Michael Meng via llvm-dev <llvm-dev at lists.llvm.org>:

Hi LLVM community, I am trying to differentiate access to different array elements, for example: for (int i = 1; i < 10; i++) { a[i] = a[i] + 10; b[i] = a[i - 1] * 2; } If it is possible to tell it loads/stores 3 different array elements: a[i], b[i] and a[i - 1] at IR level?

Thanks for your time in advance! Best, Michael


LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200219/dc9b3efb/attachment.html>



More information about the llvm-dev mailing list