Michael Meng via llvm-dev
2020-Feb-17 06:03 UTC
[llvm-dev] Differentiate array access at IR level
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200217/09e8d65b/attachment.html>
Hiroshi Yamauchi via llvm-dev
2020-Feb-18 16:39 UTC
[llvm-dev] Differentiate array access at IR level
It sounds like alias analysis can help: https://llvm.org/docs/AliasAnalysis.html On Sun, Feb 16, 2020 at 10:03 PM Michael Meng via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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/20200218/97295b84/attachment-0001.html>
Michael Kruse via llvm-dev
2020-Feb-18 17:26 UTC
[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
Michael Meng via llvm-dev
2020-Feb-19 01:16 UTC
[llvm-dev] Differentiate array access at IR level
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>
Maybe Matching Threads
- Incorrect behavior in the LLVM dependence analyzer
- valid BasicAA behavior?
- [LLVMdev] question about enabling cfl-aa and collecting a57 numbers
- [LLVMdev] Expected behavior of calling bitcasted functions?
- [LLVMdev] question about enabling cfl-aa and collecting a57 numbers