xref: /llvm-project/llvm/test/Transforms/SampleProfile/pseudo-probe-memset.ll (revision a11faeed446882a81e79d780125d93e7199df645)
1; RUN: opt < %s -passes=memcpyopt -S | FileCheck %s
2
3%struct.MV = type { i16, i16 }
4
5define void @test(ptr nocapture %c) nounwind optsize {
6; All the stores in this example should be merged into a single memset.
7; CHECK-NOT:  store i32 -1
8; CHECK: call void @llvm.memset.p0.i64
9  store i32 -1, ptr %c, align 4
10  %1 = getelementptr inbounds i32, ptr %c, i32 1
11  store i32 -1, ptr %1, align 4
12  %2 = getelementptr inbounds i32, ptr %c, i32 2
13  store i32 -1, ptr %2, align 4
14  call void @llvm.pseudoprobe(i64 5116412291814990879, i64 1, i32 0, i64 -1)
15  %3 = getelementptr inbounds i32, ptr %c, i32 3
16  store i32 -1, ptr %3, align 4
17  %4 = getelementptr inbounds i32, ptr %c, i32 4
18  store i32 -1, ptr %4, align 4
19  ret void
20}
21
22; Function Attrs: inaccessiblememonly nounwind willreturn
23declare void @llvm.pseudoprobe(i64, i64, i32, i64) #0
24
25attributes #0 = { inaccessiblememonly nounwind willreturn }
26