2 ; RUN: llvm-profdata merge %S/Inputs/consecutive-zeros.proftext -o %t.profdata
3 ; RUN: opt < %s -debug -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
5 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 define void @foo(i8* %dst, i8* %src, i32* %a, i32 %n) {
9 ; CHECK: Invalid Profile
14 %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ]
15 %cmp = icmp slt i32 %i.0, %n
16 br i1 %cmp, label %for.body, label %for.end6
22 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
23 %idx.ext = sext i32 %i.0 to i64
24 %add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext
25 %0 = load i32, i32* %add.ptr, align 4
26 %cmp2 = icmp slt i32 %j.0, %0
27 br i1 %cmp2, label %for.body3, label %for.end
30 %add = add nsw i32 %i.0, 1
31 %conv = sext i32 %add to i64
32 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false)
33 %memcmp = call i32 @memcmp(i8* %dst, i8* %src, i64 %conv)
34 %bcmp = call i32 @bcmp(i8* %dst, i8* %src, i64 %conv)
38 %inc = add nsw i32 %j.0, 1
45 %inc5 = add nsw i32 %i.0, 1
52 declare void @llvm.lifetime.start(i64, i8* nocapture)
54 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
56 declare i32 @memcmp(i8*, i8*, i64)
57 declare i32 @bcmp(i8*, i8*, i64)
59 declare void @llvm.lifetime.end(i64, i8* nocapture)