1 ; RUN: llvm-profdata merge %S/Inputs/consecutive-zeros.proftext -o %t.profdata
2 ; RUN: opt < %s -passes=pgo-instr-use,pgo-memop-opt -pgo-memop-count-threshold=0 -pgo-memop-percent-threshold=0 -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 define void @foo(ptr %dst, ptr %src, ptr %a, i32 %n) {
8 ; CHECK: warning: Invalid Profile
13 %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ]
14 %cmp = icmp slt i32 %i.0, %n
15 br i1 %cmp, label %for.body, label %for.end6
21 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
22 %idx.ext = sext i32 %i.0 to i64
23 %add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
24 %0 = load i32, ptr %add.ptr, align 4
25 %cmp2 = icmp slt i32 %j.0, %0
26 br i1 %cmp2, label %for.body3, label %for.end
29 %add = add nsw i32 %i.0, 1
30 %conv = sext i32 %add to i64
31 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false)
32 %memcmp = call i32 @memcmp(ptr %dst, ptr %src, i64 %conv)
33 %bcmp = call i32 @bcmp(ptr %dst, ptr %src, i64 %conv)
37 %inc = add nsw i32 %j.0, 1
44 %inc5 = add nsw i32 %i.0, 1
51 declare void @llvm.lifetime.start(i64, ptr nocapture)
53 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
55 declare i32 @memcmp(ptr, ptr, i64)
56 declare i32 @bcmp(ptr, ptr, i64)
58 declare void @llvm.lifetime.end(i64, ptr nocapture)