<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Do you have alias analysis enabled?<div class=""><br class=""></div><div class="">Marcello<br class=""><div style=""><blockquote type="cite" class=""><div class="">On 2 Feb 2016, at 08:35, Gleison Souza via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div style="font-size:13px" class="">Dear LLVMers,</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">    I am trying to implement a particular type of loop optimization, but I am having problems with global variables. To solve this problem, I would like to know if LLVM has some pass that moves loads outside loops. I will illustrate with an example. I want to transform this code below. I am writing in C for readability, but I am analysing LLVM IR:</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">int *vectorE;</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">void foo (int n) {       </div><div style="font-size:13px" class="">  int i;</div><div style="font-size:13px" class="">  for (i = 0; i < n; i++)</div><div style="font-size:13px" class="">    vectorE[i] = i;</div><div style="font-size:13px" class="">}</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">into this one:</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">int *vectorE;</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">void foo (int n) {       </div><div style="font-size:13px" class="">  int i;</div><div style="font-size:13px" class="">  int* aux = vectorE;</div><div style="font-size:13px" class="">  for (i = 0; i < n; i++)</div><div style="font-size:13px" class="">    aux[i] = i;</div><div style="font-size:13px" class="">}</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">Regards,</div><div style="font-size:13px" class=""><br class=""></div><div style="font-size:13px" class="">Gleison</div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>