diff options
| author | Teresa Johnson <tejohnson@google.com> | 2017-04-28 14:30:54 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2017-04-28 14:30:54 +0000 |
| commit | 51177295c485abc6b7967a385ab85b274f3878a2 (patch) | |
| tree | 5849563b13760fe910eed31b4b134007d07c9e7b /llvm/test/Transforms/PGOProfile | |
| parent | 7ae9419dc0b73cd27a629a5039a41225616b611d (diff) | |
| download | bcm5719-llvm-51177295c485abc6b7967a385ab85b274f3878a2.tar.gz bcm5719-llvm-51177295c485abc6b7967a385ab85b274f3878a2.zip | |
Memory intrinsic value profile optimization: Avoid divide by 0
Summary:
Skip memops if the total value profiled count is 0, we can't correctly
scale up the counts and there is no point anyway.
Reviewers: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D32624
llvm-svn: 301645
Diffstat (limited to 'llvm/test/Transforms/PGOProfile')
| -rw-r--r-- | llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll b/llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll new file mode 100644 index 00000000000..ede34f0de80 --- /dev/null +++ b/llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll @@ -0,0 +1,19 @@ +; Test to ensure the pgo memop optimization pass doesn't try to scale +; up a value profile with a 0 count, which would lead to divide by 0. +; RUN: opt < %s -passes=pgo-memop-opt -pgo-memop-count-threshold=1 -S | FileCheck %s --check-prefix=MEMOP_OPT +; RUN: opt < %s -pgo-memop-opt -pgo-memop-count-threshold=1 -S | FileCheck %s --check-prefix=MEMOP_OPT + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @foo(i8* %dst, i8* %src, i64 %conv) !prof !0 { + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i32 1, i1 false), !prof !1 + ret void +} + +; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i32 1, i1 false), !prof !1 + +!0 = !{!"function_entry_count", i64 1} +!1 = !{!"VP", i32 1, i64 0, i64 1, i64 0, i64 2, i64 0, i64 3, i64 0, i64 9, i64 0, i64 4, i64 0, i64 5, i64 0, i64 6, i64 0, i64 7, i64 0, i64 8, i64 0} + +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1) |

