<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)/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.<br clear="all"><div><div><div><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Regards<br></div>Shalini<br></div></div>
</div></div></div></div></div>