<div dir="ltr"><div>Would probably help a whole lot if you explained what error you are getting... <br><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 July 2017 at 11:07, SHALINI JAIN via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I want to profile each loop in order to collect execution time. Currently I inserted following timer instructions into LLVM IR Version3.4 and successfully got the results.<br><br>before loop:<br></div><div>In C: <br> int t1=clock(); <br><br></div><div>Equilavent IR:<br></div><div> %t1 = alloca i32, align 4<div> %t2 = alloca i32, align 4</div><div> %1 = call i64 @clock() #3</div><div> %2 = trunc i64 %1 to i32</div><div> store i32 %2, i32* %t1, align 4<br><br>After loop:<br></div><div>In C: <br> int t2=clock(); <br></div><div> printf("%f\n",((float)t2-t1)/<wbr>CLOCKS_PER_SEC);<br></div><div><br></div><div>Equivalent IR:<br></div><div>%3 = call i64 @clock() #3<div> %4 = trunc i64 %3 to i32</div><div> store i32 %4, i32* %t2, align 4</div><div> %5 = load i32* %t2, align 4</div><div> %6 = sitofp i32 %5 to float</div><div> %7 = load i32* %t1, align 4</div><div> %8 = sitofp i32 %7 to float</div><div> %9 = fsub float %6, %8</div><div> %10 = fdiv float %9, 1.000000e+06</div><div> %11 = fpext float %10 to double</div><div> %12 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double %11)</div><br></div><br></div>I want to do the same in LLVM4.0. I tried inserted these got error.<span class="HOEnZb"><font color="#888888"><br clear="all"><div><div><div><div><br>-- <br><div class="m_4855504159241114058gmail_signature"><div dir="ltr"><div>Regards<br></div>Shalini<br></div></div>
</div></div></div></div></font></span></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>