Hi, Zhiyuan Yang,<br><br>Are you trying to replace the for-loop with equivalent if-goto loop? In this case, do you also need a goto after i++?<br>LLVM IR in fact already contains exactly the goto-form of any loop, because IR has no high-level constructs like for or while.<br>
<br>- D.<br><br><div class="gmail_quote">2013/4/17 zhiyuan yang <span dir="ltr"><<a href="mailto:sjtu.yzy@gmail.com" target="_blank">sjtu.yzy@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hello everyone, </span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Sorry to bother you. I'm an undergraduate, and I'm trying to finish my graduation project using LLVM. In this project, I hope to transform all loop in program to condition statement. For example,</div>

<div style="font-family:arial,sans-serif;font-size:13px">Before transformation: for (int i = 0; i < 5; i++) a++;</div><div style="font-family:arial,sans-serif;font-size:13px">After transformation: int i = 0; if (i < 5) a++; i++;</div>

<div style="font-family:arial,sans-serif;font-size:13px">The idea is very clear, however, I'm a newbie to LLVM. After read code of some LLVM's transformation, I still have no idea of how to implement this idea.</div>

<div style="font-family:arial,sans-serif;font-size:13px">Hope you can give me some hint. Thank you very much!</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br>