<div dir="ltr">Does your function in prog1.ll have the optnone attribute on it? If so try adding "-Xclang -disable-O0-optnone" to your clang command line<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 1, 2021 at 11:35 PM Sudakshina Dutta via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear all,</div><div><br></div><div>Greetings. I have been trying to have a loop invariant code motion on the LLVM IR (.ll) file which has been generated from the following .c file.</div><div><br></div><div>int main()<br>{<br>    int a = 5, b = 20, c = 50, d = 1, x;<br>    while(a < b)<br>    {<br>        x = d + 1;<br>        x = d + 2;<br>        c = c + 5;<br>        a = a + 1;<br>    }<br>}</div><div>Both the first two statements should qualify for loop invariant code motion. However, loop invariant code does not move out of the loop in the generated .ll file. Note that I have applied the following commands.</div><div><br></div><div> clang -S -emit-llvm prog1.c  -o prog1.ll</div><div>opt -licm -S prog1.ll -o prog1-opt3.ll -opt-bisect-limit=300</div><div><br></div><div>Can you please help in this regard ?</div><div><br></div><div>Thanks and regards,</div><div>Sudakshina<br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>