1 ; RUN: opt <%s -passes=pgo-instr-gen,instrprof -S | FileCheck %s
2 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 define void @foo(ptr %dst, ptr %src, ptr %a, i32 %n) {
10 %i.0 = phi i32 [ 0, %entry ], [ %add, %for.cond1 ]
11 %cmp = icmp slt i32 %i.0, %n
12 br i1 %cmp, label %for.cond1, label %for.end6
15 %j.0 = phi i32 [ %inc, %for.body3 ], [ 0, %for.cond ]
16 %idx.ext = sext i32 %i.0 to i64
17 %add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
18 %0 = load i32, ptr %add.ptr, align 4
19 %cmp2 = icmp slt i32 %j.0, %0
20 %add = add nsw i32 %i.0, 1
21 br i1 %cmp2, label %for.body3, label %for.cond
24 %conv = sext i32 %add to i64
25 ; CHECK: call void @__llvm_profile_instrument_memop(i64 %conv, ptr @__profd_foo, i32 0)
26 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false)
27 %inc = add nsw i32 %j.0, 1
34 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)