[llvm-dev] (no subject)
SHALINI JAIN via llvm-dev
llvm-dev at lists.llvm.org
Thu Jul 6 03:07:44 PDT 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170706/22a66dbc/attachment.html>
More information about the llvm-dev
mailing list