diff options
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/Profiling/edge-profiling.ll | 139 | ||||
-rw-r--r-- | test/Analysis/Profiling/lit.local.cfg | 2 | ||||
-rw-r--r-- | test/Analysis/Profiling/load-branch-weights-ifs.ll | 122 | ||||
-rw-r--r-- | test/Analysis/Profiling/load-branch-weights-loops.ll | 188 | ||||
-rw-r--r-- | test/Analysis/Profiling/load-branch-weights-switches.ll | 165 | ||||
-rw-r--r-- | test/Analysis/Profiling/profiling-tool-chain.ll | 212 |
6 files changed, 0 insertions, 828 deletions
diff --git a/test/Analysis/Profiling/edge-profiling.ll b/test/Analysis/Profiling/edge-profiling.ll deleted file mode 100644 index cbaf476..0000000 --- a/test/Analysis/Profiling/edge-profiling.ll +++ /dev/null @@ -1,139 +0,0 @@ -; Test the edge profiling instrumentation. -; RUN: opt < %s -insert-edge-profiling -S | FileCheck %s - -; ModuleID = '<stdin>' - -@.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1] -@.str1 = private constant [6 x i8] c"franz\00", align 1 ; <[6 x i8]*> [#uses=1] -@.str2 = private constant [9 x i8] c"argc > 2\00", align 1 ; <[9 x i8]*> [#uses=1] -@.str3 = private constant [9 x i8] c"argc = 1\00", align 1 ; <[9 x i8]*> [#uses=1] -@.str4 = private constant [6 x i8] c"fritz\00", align 1 ; <[6 x i8]*> [#uses=1] -@.str5 = private constant [10 x i8] c"argc <= 1\00", align 1 ; <[10 x i8]*> [#uses=1] -; CHECK:@EdgeProfCounters -; CHECK:[19 x i32] -; CHECK:zeroinitializer - -define void @oneblock() nounwind { -entry: -; CHECK:entry: -; CHECK:%OldFuncCounter -; CHECK:load -; CHECK:getelementptr -; CHECK:@EdgeProfCounters -; CHECK:i32 0 -; CHECK:i32 0 -; CHECK:%NewFuncCounter -; CHECK:add -; CHECK:%OldFuncCounter -; CHECK:store -; CHECK:%NewFuncCounter -; CHECK:getelementptr -; CHECK:@EdgeProfCounters - %0 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - ret void -} - -declare i32 @puts(i8*) - -define i32 @main(i32 %argc, i8** %argv) nounwind { -entry: -; CHECK:entry: - %argc_addr = alloca i32 ; <i32*> [#uses=4] - %argv_addr = alloca i8** ; <i8***> [#uses=1] - %retval = alloca i32 ; <i32*> [#uses=2] - %j = alloca i32 ; <i32*> [#uses=4] - %i = alloca i32 ; <i32*> [#uses=4] - %0 = alloca i32 ; <i32*> [#uses=2] -; CHECK:call -; CHECK:@llvm_start_edge_profiling -; CHECK:@EdgeProfCounters - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i32 %argc, i32* %argc_addr - store i8** %argv, i8*** %argv_addr - store i32 0, i32* %i, align 4 - br label %bb10 - -bb: ; preds = %bb10 -; CHECK:bb: - %1 = load i32* %argc_addr, align 4 ; <i32> [#uses=1] - %2 = icmp sgt i32 %1, 1 ; <i1> [#uses=1] - br i1 %2, label %bb1, label %bb8 - -bb1: ; preds = %bb -; CHECK:bb1: - store i32 0, i32* %j, align 4 - br label %bb6 - -bb2: ; preds = %bb6 -; CHECK:bb2: - %3 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - %4 = load i32* %argc_addr, align 4 ; <i32> [#uses=1] - %5 = icmp sgt i32 %4, 2 ; <i1> [#uses=1] - br i1 %5, label %bb3, label %bb4 - -bb3: ; preds = %bb2 -; CHECK:bb3: - %6 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str2, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - br label %bb5 - -bb4: ; preds = %bb2 -; CHECK:bb4: - %7 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str3, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - br label %bb11 - -bb5: ; preds = %bb3 -; CHECK:bb5: - %8 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str4, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - %9 = load i32* %j, align 4 ; <i32> [#uses=1] - %10 = add nsw i32 %9, 1 ; <i32> [#uses=1] - store i32 %10, i32* %j, align 4 - br label %bb6 - -bb6: ; preds = %bb5, %bb1 -; CHECK:bb6: - %11 = load i32* %j, align 4 ; <i32> [#uses=1] - %12 = load i32* %argc_addr, align 4 ; <i32> [#uses=1] - %13 = icmp slt i32 %11, %12 ; <i1> [#uses=1] - br i1 %13, label %bb2, label %bb7 - -bb7: ; preds = %bb6 -; CHECK:bb7: - br label %bb9 - -bb8: ; preds = %bb -; CHECK:bb8: - %14 = call i32 @puts(i8* getelementptr inbounds ([10 x i8]* @.str5, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - br label %bb9 - -bb9: ; preds = %bb8, %bb7 -; CHECK:bb9: - %15 = load i32* %i, align 4 ; <i32> [#uses=1] - %16 = add nsw i32 %15, 1 ; <i32> [#uses=1] - store i32 %16, i32* %i, align 4 - br label %bb10 - -bb10: ; preds = %bb9, %entry -; CHECK:bb10: - %17 = load i32* %i, align 4 ; <i32> [#uses=1] - %18 = icmp ne i32 %17, 3 ; <i1> [#uses=1] - br i1 %18, label %bb, label %bb11 -; CHECK:br -; CHECK:label %bb10.bb11_crit_edge - -; CHECK:bb10.bb11_crit_edge: -; CHECK:br -; CHECK:label %bb11 - -bb11: ; preds = %bb10, %bb4 -; CHECK:bb11: - call void @oneblock() nounwind - store i32 0, i32* %0, align 4 - %19 = load i32* %0, align 4 ; <i32> [#uses=1] - store i32 %19, i32* %retval, align 4 - br label %return - -return: ; preds = %bb11 -; CHECK:return: - %retval12 = load i32* %retval ; <i32> [#uses=1] - ret i32 %retval12 -} diff --git a/test/Analysis/Profiling/lit.local.cfg b/test/Analysis/Profiling/lit.local.cfg deleted file mode 100644 index 5481b13..0000000 --- a/test/Analysis/Profiling/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if 'hexagon' in config.root.target_triple: - config.unsupported = True diff --git a/test/Analysis/Profiling/load-branch-weights-ifs.ll b/test/Analysis/Profiling/load-branch-weights-ifs.ll deleted file mode 100644 index 7ed090b..0000000 --- a/test/Analysis/Profiling/load-branch-weights-ifs.ll +++ /dev/null @@ -1,122 +0,0 @@ -; RUN: opt -insert-edge-profiling -o %t1 < %s -; RUN: rm -f %t1.prof_data -; RUN: lli %defaultjit -load %llvmshlibdir/libprofile_rt%shlibext %t1 \ -; RUN: -llvmprof-output %t1.prof_data -; RUN: opt -profile-file %t1.prof_data -profile-metadata-loader -S -o - < %s \ -; RUN: | FileCheck %s -; RUN: rm -f %t1.prof_data - -; FIXME: profile_rt.dll could be built on win32. -; REQUIRES: loadable_module - -;; func_mod - Branch taken 6 times in 7. -define i32 @func_mod(i32 %N) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %N.addr = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - %0 = load i32* %N.addr, align 4 - %rem = srem i32 %0, 7 - %tobool = icmp ne i32 %rem, 0 - br i1 %tobool, label %if.then, label %if.else -; CHECK: br i1 %tobool, label %if.then, label %if.else, !prof !0 - -if.then: - store i32 1, i32* %retval - br label %return - -if.else: - store i32 0, i32* %retval - br label %return - -return: - %1 = load i32* %retval - ret i32 %1 -} - -;; func_const_true - conditional branch which 100% taken probability. -define i32 @func_const_true(i32 %N) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %N.addr = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - %0 = load i32* %N.addr, align 4 - %cmp = icmp eq i32 %0, 1 - br i1 %cmp, label %if.then, label %if.end -; CHECK: br i1 %cmp, label %if.then, label %if.end, !prof !1 - -if.then: - store i32 1, i32* %retval - br label %return - -if.end: - store i32 0, i32* %retval - br label %return - -return: - %1 = load i32* %retval - ret i32 %1 -} - -;; func_const_true - conditional branch which 100% not-taken probability. -define i32 @func_const_false(i32 %N) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %N.addr = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - %0 = load i32* %N.addr, align 4 - %cmp = icmp eq i32 %0, 1 - br i1 %cmp, label %if.then, label %if.end -; CHECK: br i1 %cmp, label %if.then, label %if.end, !prof !2 - -if.then: - store i32 1, i32* %retval - br label %return - -if.end: - store i32 0, i32* %retval - br label %return - -return: - %1 = load i32* %retval - ret i32 %1 -} - -define i32 @main(i32 %argc, i8** %argv) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %argc.addr = alloca i32, align 4 - %argv.addr = alloca i8**, align 8 - %loop = alloca i32, align 4 - store i32 0, i32* %retval - store i32 0, i32* %loop, align 4 - br label %for.cond - -for.cond: - %0 = load i32* %loop, align 4 - %cmp = icmp slt i32 %0, 7000 - br i1 %cmp, label %for.body, label %for.end -; CHECK: br i1 %cmp, label %for.body, label %for.end, !prof !3 - -for.body: - %1 = load i32* %loop, align 4 - %call = call i32 @func_mod(i32 %1) - br label %for.inc - -for.inc: - %2 = load i32* %loop, align 4 - %inc = add nsw i32 %2, 1 - store i32 %inc, i32* %loop, align 4 - br label %for.cond - -for.end: - %call1 = call i32 @func_const_true(i32 1) - %call2 = call i32 @func_const_false(i32 0) - ret i32 0 -} - -; CHECK: !0 = metadata !{metadata !"branch_weights", i32 6000, i32 1000} -; CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 0} -; CHECK: !2 = metadata !{metadata !"branch_weights", i32 0, i32 1} -; CHECK: !3 = metadata !{metadata !"branch_weights", i32 7000, i32 1} -; CHECK-NOT: !4 diff --git a/test/Analysis/Profiling/load-branch-weights-loops.ll b/test/Analysis/Profiling/load-branch-weights-loops.ll deleted file mode 100644 index 9d1925a..0000000 --- a/test/Analysis/Profiling/load-branch-weights-loops.ll +++ /dev/null @@ -1,188 +0,0 @@ -; RUN: opt -insert-edge-profiling -o %t1 < %s -; RUN: rm -f %t1.prof_data -; RUN: lli %defaultjit -load %llvmshlibdir/libprofile_rt%shlibext %t1 \ -; RUN: -llvmprof-output %t1.prof_data -; RUN: opt -profile-file %t1.prof_data -profile-metadata-loader -S -o - < %s \ -; RUN: | FileCheck %s -; RUN: rm -f %t1.prof_data - -; FIXME: profile_rt.dll could be built on win32. -; REQUIRES: loadable_module - -;; func_for - Test branch probabilities for a vanilla for loop. -define i32 @func_for(i32 %N) nounwind uwtable { -entry: - %N.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %loop = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - store i32 0, i32* %ret, align 4 - store i32 0, i32* %loop, align 4 - br label %for.cond - -for.cond: - %0 = load i32* %loop, align 4 - %1 = load i32* %N.addr, align 4 - %cmp = icmp slt i32 %0, %1 - br i1 %cmp, label %for.body, label %for.end -; CHECK: br i1 %cmp, label %for.body, label %for.end, !prof !0 - -for.body: - %2 = load i32* %N.addr, align 4 - %3 = load i32* %ret, align 4 - %add = add nsw i32 %3, %2 - store i32 %add, i32* %ret, align 4 - br label %for.inc - -for.inc: - %4 = load i32* %loop, align 4 - %inc = add nsw i32 %4, 1 - store i32 %inc, i32* %loop, align 4 - br label %for.cond - -for.end: - %5 = load i32* %ret, align 4 - ret i32 %5 -} - -;; func_for_odd - Test branch probabilities for a for loop with a continue and -;; a break. -define i32 @func_for_odd(i32 %N) nounwind uwtable { -entry: - %N.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %loop = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - store i32 0, i32* %ret, align 4 - store i32 0, i32* %loop, align 4 - br label %for.cond - -for.cond: - %0 = load i32* %loop, align 4 - %1 = load i32* %N.addr, align 4 - %cmp = icmp slt i32 %0, %1 - br i1 %cmp, label %for.body, label %for.end -; CHECK: br i1 %cmp, label %for.body, label %for.end, !prof !1 - -for.body: - %2 = load i32* %loop, align 4 - %rem = srem i32 %2, 10 - %tobool = icmp ne i32 %rem, 0 - br i1 %tobool, label %if.then, label %if.end -; CHECK: br i1 %tobool, label %if.then, label %if.end, !prof !2 - -if.then: - br label %for.inc - -if.end: - %3 = load i32* %loop, align 4 - %cmp1 = icmp eq i32 %3, 500 - br i1 %cmp1, label %if.then2, label %if.end3 -; CHECK: br i1 %cmp1, label %if.then2, label %if.end3, !prof !3 - -if.then2: - br label %for.end - -if.end3: - %4 = load i32* %N.addr, align 4 - %5 = load i32* %ret, align 4 - %add = add nsw i32 %5, %4 - store i32 %add, i32* %ret, align 4 - br label %for.inc - -for.inc: - %6 = load i32* %loop, align 4 - %inc = add nsw i32 %6, 1 - store i32 %inc, i32* %loop, align 4 - br label %for.cond - -for.end: - %7 = load i32* %ret, align 4 - ret i32 %7 -} - -;; func_while - Test branch probability in a vanilla while loop. -define i32 @func_while(i32 %N) nounwind uwtable { -entry: - %N.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %loop = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - store i32 0, i32* %ret, align 4 - store i32 0, i32* %loop, align 4 - br label %while.cond - -while.cond: - %0 = load i32* %loop, align 4 - %1 = load i32* %N.addr, align 4 - %cmp = icmp slt i32 %0, %1 - br i1 %cmp, label %while.body, label %while.end -; CHECK: br i1 %cmp, label %while.body, label %while.end, !prof !0 - -while.body: - %2 = load i32* %N.addr, align 4 - %3 = load i32* %ret, align 4 - %add = add nsw i32 %3, %2 - store i32 %add, i32* %ret, align 4 - %4 = load i32* %loop, align 4 - %inc = add nsw i32 %4, 1 - store i32 %inc, i32* %loop, align 4 - br label %while.cond - -while.end: - %5 = load i32* %ret, align 4 - ret i32 %5 -} - -;; func_while - Test branch probability in a vanilla do-while loop. -define i32 @func_do_while(i32 %N) nounwind uwtable { -entry: - %N.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %loop = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - store i32 0, i32* %ret, align 4 - store i32 0, i32* %loop, align 4 - br label %do.body - -do.body: - %0 = load i32* %N.addr, align 4 - %1 = load i32* %ret, align 4 - %add = add nsw i32 %1, %0 - store i32 %add, i32* %ret, align 4 - %2 = load i32* %loop, align 4 - %inc = add nsw i32 %2, 1 - store i32 %inc, i32* %loop, align 4 - br label %do.cond - -do.cond: - %3 = load i32* %loop, align 4 - %4 = load i32* %N.addr, align 4 - %cmp = icmp slt i32 %3, %4 - br i1 %cmp, label %do.body, label %do.end -; CHECK: br i1 %cmp, label %do.body, label %do.end, !prof !4 - -do.end: - %5 = load i32* %ret, align 4 - ret i32 %5 -} - -define i32 @main(i32 %argc, i8** %argv) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %argc.addr = alloca i32, align 4 - %argv.addr = alloca i8**, align 8 - store i32 0, i32* %retval - %call = call i32 @func_for(i32 1000) - %call1 = call i32 @func_for_odd(i32 1000) - %call2 = call i32 @func_while(i32 1000) - %call3 = call i32 @func_do_while(i32 1000) - ret i32 0 -} - -!0 = metadata !{metadata !"branch_weights", i32 1000, i32 1} -!1 = metadata !{metadata !"branch_weights", i32 501, i32 0} -!2 = metadata !{metadata !"branch_weights", i32 450, i32 51} -!3 = metadata !{metadata !"branch_weights", i32 1, i32 50} -!4 = metadata !{metadata !"branch_weights", i32 999, i32 1} -; CHECK-NOT: !5 diff --git a/test/Analysis/Profiling/load-branch-weights-switches.ll b/test/Analysis/Profiling/load-branch-weights-switches.ll deleted file mode 100644 index 5587c71..0000000 --- a/test/Analysis/Profiling/load-branch-weights-switches.ll +++ /dev/null @@ -1,165 +0,0 @@ -; RUN: opt -insert-edge-profiling -o %t1 < %s -; RUN: rm -f %t1.prof_data -; RUN: lli %defaultjit -load %llvmshlibdir/libprofile_rt%shlibext %t1 \ -; RUN: -llvmprof-output %t1.prof_data -; RUN: opt -profile-file %t1.prof_data -profile-metadata-loader -S -o - < %s \ -; RUN: | FileCheck %s -; RUN: rm -f %t1.prof_data - -; FIXME: profile_rt.dll could be built on win32. -; REQUIRES: loadable_module - -;; func_switch - Test branch probabilities for a switch instruction with an -;; even chance of taking each case (or no case). -define i32 @func_switch(i32 %N) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %N.addr = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - %0 = load i32* %N.addr, align 4 - %rem = srem i32 %0, 4 - switch i32 %rem, label %sw.epilog [ - i32 0, label %sw.bb - i32 1, label %sw.bb1 - i32 2, label %sw.bb2 - ] -; CHECK: ], !prof !0 - -sw.bb: - store i32 5, i32* %retval - br label %return - -sw.bb1: - store i32 6, i32* %retval - br label %return - -sw.bb2: - store i32 7, i32* %retval - br label %return - -sw.epilog: - store i32 8, i32* %retval - br label %return - -return: - %1 = load i32* %retval - ret i32 %1 -} - -;; func_switch_switch - Test branch probabilities in a switch-instruction that -;; leads to further switch instructions. The first-tier switch occludes some -;; possibilities in the second-tier switches, leading to some branches having a -;; 0 probability. -define i32 @func_switch_switch(i32 %N) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %N.addr = alloca i32, align 4 - store i32 %N, i32* %N.addr, align 4 - %0 = load i32* %N.addr, align 4 - %rem = srem i32 %0, 2 - switch i32 %rem, label %sw.default11 [ - i32 0, label %sw.bb - i32 1, label %sw.bb5 - ] -; CHECK: ], !prof !1 - -sw.bb: - %1 = load i32* %N.addr, align 4 - %rem1 = srem i32 %1, 4 - switch i32 %rem1, label %sw.default [ - i32 0, label %sw.bb2 - i32 1, label %sw.bb3 - i32 2, label %sw.bb4 - ] -; CHECK: ], !prof !2 - -sw.bb2: - store i32 5, i32* %retval - br label %return - -sw.bb3: - store i32 6, i32* %retval - br label %return - -sw.bb4: - store i32 7, i32* %retval - br label %return - -sw.default: - store i32 8, i32* %retval - br label %return - -sw.bb5: - %2 = load i32* %N.addr, align 4 - %rem6 = srem i32 %2, 4 - switch i32 %rem6, label %sw.default10 [ - i32 0, label %sw.bb7 - i32 1, label %sw.bb8 - i32 2, label %sw.bb9 - ] -; CHECK: ], !prof !3 - -sw.bb7: - store i32 9, i32* %retval - br label %return - -sw.bb8: - store i32 10, i32* %retval - br label %return - -sw.bb9: - store i32 11, i32* %retval - br label %return - -sw.default10: - store i32 12, i32* %retval - br label %return - -sw.default11: - store i32 13, i32* %retval - br label %return - -return: - %3 = load i32* %retval - ret i32 %3 -} - -define i32 @main(i32 %argc, i8** %argv) nounwind uwtable { -entry: - %retval = alloca i32, align 4 - %argc.addr = alloca i32, align 4 - %argv.addr = alloca i8**, align 8 - %loop = alloca i32, align 4 - store i32 0, i32* %retval - store i32 0, i32* %loop, align 4 - br label %for.cond - -for.cond: - %0 = load i32* %loop, align 4 - %cmp = icmp slt i32 %0, 4000 - br i1 %cmp, label %for.body, label %for.end -; CHECK: br i1 %cmp, label %for.body, label %for.end, !prof !4 - -for.body: - %1 = load i32* %loop, align 4 - %call = call i32 @func_switch(i32 %1) - %2 = load i32* %loop, align 4 - %call1 = call i32 @func_switch_switch(i32 %2) - br label %for.inc - -for.inc: - %3 = load i32* %loop, align 4 - %inc = add nsw i32 %3, 1 - store i32 %inc, i32* %loop, align 4 - br label %for.cond - -for.end: - ret i32 0 -} - -; CHECK: !0 = metadata !{metadata !"branch_weights", i32 1000, i32 1000, i32 1000, i32 1000} -; CHECK: !1 = metadata !{metadata !"branch_weights", i32 0, i32 2000, i32 2000} -; CHECK: !2 = metadata !{metadata !"branch_weights", i32 0, i32 1000, i32 0, i32 1000} -; CHECK: !3 = metadata !{metadata !"branch_weights", i32 1000, i32 0, i32 1000, i32 0} -; CHECK: !4 = metadata !{metadata !"branch_weights", i32 4000, i32 1} -; CHECK-NOT: !5 diff --git a/test/Analysis/Profiling/profiling-tool-chain.ll b/test/Analysis/Profiling/profiling-tool-chain.ll deleted file mode 100644 index 9135a85..0000000 --- a/test/Analysis/Profiling/profiling-tool-chain.ll +++ /dev/null @@ -1,212 +0,0 @@ -; RUN: llvm-as %s -o %t1 - -; FIXME: The RUX parts of the test are disabled for now, they aren't working on -; llvm-gcc-x86_64-darwin10-selfhost. - -; Test the edge optimal profiling instrumentation. -; RUN: opt %t1 -insert-optimal-edge-profiling -o %t2 -; RUX: llvm-dis < %t2 | FileCheck --check-prefix=INST %s - -; Test the creation, reading and displaying of profile -; RUX: rm -f llvmprof.out -; RUX: lli -load %llvmshlibdir/profile_rt%shlibext %t2 -; RUX: lli -load %llvmshlibdir/profile_rt%shlibext %t2 1 2 -; RUX: llvm-prof -print-all-code %t1 | FileCheck --check-prefix=PROF %s - -; Test the loaded profile also with verifier. -; RUX opt %t1 -profile-loader -profile-verifier -o %t3 - -; Test profile estimator. -; RUN: opt %t1 -profile-estimator -profile-verifier -o %t3 - -; PROF: 1. 2/4 oneblock -; PROF: 2. 2/4 main -; PROF: 1. 15.7895% 12/76 main() - bb6 -; PROF: 2. 11.8421% 9/76 main() - bb2 -; PROF: 3. 11.8421% 9/76 main() - bb3 -; PROF: 4. 11.8421% 9/76 main() - bb5 -; PROF: 5. 10.5263% 8/76 main() - bb10 -; PROF: 6. 7.89474% 6/76 main() - bb -; PROF: 7. 7.89474% 6/76 main() - bb9 -; PROF: 8. 3.94737% 3/76 main() - bb1 -; PROF: 9. 3.94737% 3/76 main() - bb7 -; PROF: 10. 3.94737% 3/76 main() - bb8 -; PROF: 11. 2.63158% 2/76 oneblock() - entry -; PROF: 12. 2.63158% 2/76 main() - entry -; PROF: 13. 2.63158% 2/76 main() - bb11 -; PROF: 14. 2.63158% 2/76 main() - return - -; ModuleID = '<stdin>' - -@.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1] -@.str1 = private constant [6 x i8] c"franz\00", align 1 ; <[6 x i8]*> [#uses=1] -@.str2 = private constant [9 x i8] c"argc > 2\00", align 1 ; <[9 x i8]*> [#uses=1] -@.str3 = private constant [9 x i8] c"argc = 1\00", align 1 ; <[9 x i8]*> [#uses=1] -@.str4 = private constant [6 x i8] c"fritz\00", align 1 ; <[6 x i8]*> [#uses=1] -@.str5 = private constant [10 x i8] c"argc <= 1\00", align 1 ; <[10 x i8]*> [#uses=1] -; INST:@OptEdgeProfCounters -; INST:[21 x i32] -; INST:[i32 0, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 0, -; INST:i32 0, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 0, -; INST:i32 0, -; INST:i32 -1, -; INST:i32 -1, -; INST:i32 0, -; INST:i32 -1, -; INST:i32 -1] - -; PROF:;;; %oneblock called 2 times. -; PROF:;;; -define void @oneblock() nounwind { -entry: -; PROF:entry: -; PROF: ;;; Basic block executed 2 times. - %0 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - ret void -} - -declare i32 @puts(i8*) - -; PROF:;;; %main called 2 times. -; PROF:;;; -define i32 @main(i32 %argc, i8** %argv) nounwind { -entry: -; PROF:entry: -; PROF: ;;; Basic block executed 2 times. - %argc_addr = alloca i32 ; <i32*> [#uses=4] - %argv_addr = alloca i8** ; <i8***> [#uses=1] - %retval = alloca i32 ; <i32*> [#uses=2] - %j = alloca i32 ; <i32*> [#uses=4] - %i = alloca i32 ; <i32*> [#uses=4] - %0 = alloca i32 ; <i32*> [#uses=2] -; INST:call -; INST:@llvm_start_opt_edge_profiling -; INST:@OptEdgeProfCounters - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i32 %argc, i32* %argc_addr - store i8** %argv, i8*** %argv_addr - store i32 0, i32* %i, align 4 - br label %bb10 -; PROF: ;;; Out-edge counts: [2.000000e+00 -> bb10] - -bb: ; preds = %bb10 -; PROF:bb: -; PROF: ;;; Basic block executed 6 times. - %1 = load i32* %argc_addr, align 4 ; <i32> [#uses=1] - %2 = icmp sgt i32 %1, 1 ; <i1> [#uses=1] - br i1 %2, label %bb1, label %bb8 -; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb1] [3.000000e+00 -> bb8] - -bb1: ; preds = %bb -; PROF:bb1: -; PROF: ;;; Basic block executed 3 times. - store i32 0, i32* %j, align 4 - br label %bb6 -; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb6] - -bb2: ; preds = %bb6 -; PROF:bb2: -; PROF: ;;; Basic block executed 9 times. - %3 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - %4 = load i32* %argc_addr, align 4 ; <i32> [#uses=1] - %5 = icmp sgt i32 %4, 2 ; <i1> [#uses=1] - br i1 %5, label %bb3, label %bb4 -; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb3] - -bb3: ; preds = %bb2 -; PROF:bb3: -; PROF: ;;; Basic block executed 9 times. - %6 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str2, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - br label %bb5 -; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb5] - -bb4: ; preds = %bb2 -; PROF:bb4: -; PROF: ;;; Never executed! - %7 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str3, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - br label %bb11 - -bb5: ; preds = %bb3 -; PROF:bb5: -; PROF: ;;; Basic block executed 9 times. - %8 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str4, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - %9 = load i32* %j, align 4 ; <i32> [#uses=1] - %10 = add nsw i32 %9, 1 ; <i32> [#uses=1] - store i32 %10, i32* %j, align 4 - br label %bb6 -; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb6] - -bb6: ; preds = %bb5, %bb1 -; PROF:bb6: -; PROF: ;;; Basic block executed 12 times. - %11 = load i32* %j, align 4 ; <i32> [#uses=1] - %12 = load i32* %argc_addr, align 4 ; <i32> [#uses=1] - %13 = icmp slt i32 %11, %12 ; <i1> [#uses=1] - br i1 %13, label %bb2, label %bb7 -; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb2] [3.000000e+00 -> bb7] - -bb7: ; preds = %bb6 -; PROF:bb7: -; PROF: ;;; Basic block executed 3 times. - br label %bb9 -; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb9] - -bb8: ; preds = %bb -; PROF:bb8: -; PROF: ;;; Basic block executed 3 times. - %14 = call i32 @puts(i8* getelementptr inbounds ([10 x i8]* @.str5, i64 0, i64 0)) nounwind ; <i32> [#uses=0] - br label %bb9 -; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb9] - -bb9: ; preds = %bb8, %bb7 -; PROF:bb9: -; PROF: ;;; Basic block executed 6 times. - %15 = load i32* %i, align 4 ; <i32> [#uses=1] - %16 = add nsw i32 %15, 1 ; <i32> [#uses=1] - store i32 %16, i32* %i, align 4 - br label %bb10 -; PROF: ;;; Out-edge counts: [6.000000e+00 -> bb10] - -bb10: ; preds = %bb9, %entry -; PROF:bb10: -; PROF: ;;; Basic block executed 8 times. - %17 = load i32* %i, align 4 ; <i32> [#uses=1] - %18 = icmp ne i32 %17, 3 ; <i1> [#uses=1] - br i1 %18, label %bb, label %bb11 -; INST:br -; INST:label %bb10.bb11_crit_edge -; PROF: ;;; Out-edge counts: [6.000000e+00 -> bb] [2.000000e+00 -> bb11] - -; INST:bb10.bb11_crit_edge: -; INST:br -; INST:label %bb11 - -bb11: ; preds = %bb10, %bb4 -; PROF:bb11: -; PROF: ;;; Basic block executed 2 times. - call void @oneblock() nounwind - store i32 0, i32* %0, align 4 - %19 = load i32* %0, align 4 ; <i32> [#uses=1] - store i32 %19, i32* %retval, align 4 - br label %return -; PROF: ;;; Out-edge counts: [2.000000e+00 -> return] - -return: ; preds = %bb11 -; PROF:return: -; PROF: ;;; Basic block executed 2 times. - %retval12 = load i32* %retval ; <i32> [#uses=1] - ret i32 %retval12 -} |