[llvm-dev] (no subject)

mats petersson via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 6 03:11:08 PDT 2017


Would probably help a whole lot if you explained what error you are
getting...

--
Mats

On 6 July 2017 at 11:07, SHALINI JAIN via llvm-dev <llvm-dev at lists.llvm.org>
wrote:

> Hi,
>
> 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.
>
> before loop:
> In C:
>          int t1=clock();
>
> Equilavent IR:
>   %t1 = alloca i32, align 4
>   %t2 = alloca i32, align 4
>   %1 = call i64 @clock() #3
>   %2 = trunc i64 %1 to i32
>   store i32 %2, i32* %t1, align 4
>
> After loop:
> In C:
>          int t2=clock();
>          printf("%f\n",((float)t2-t1)/CLOCKS_PER_SEC);
>
> Equivalent IR:
> %3 = call i64 @clock() #3
>   %4 = trunc i64 %3 to i32
>   store i32 %4, i32* %t2, align 4
>   %5 = load i32* %t2, align 4
>   %6 = sitofp i32 %5 to float
>   %7 = load i32* %t1, align 4
>   %8 = sitofp i32 %7 to float
>   %9 = fsub float %6, %8
>   %10 = fdiv float %9, 1.000000e+06
>   %11 = fpext float %10 to double
>   %12 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]*
> @.str, i32 0, i32 0), double %11)
>
>
> I want to do the same in LLVM4.0. I tried inserted these got error.
>
> --
> Regards
> Shalini
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170706/05714c04/attachment.html>


More information about the llvm-dev mailing list