• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
3target triple = "i686-pc-windows-msvc18.0.0"
4
5%struct.T = type { i64, [3 x i32] }
6
7; Function Attrs: nounwind optsize
8define void @f(i8* %p, i8* %q, i32* inalloca nocapture %unused) #0 {
9entry:
10  %g = alloca %struct.T, align 8
11  %r = alloca i32, align 8
12  store i32 0, i32* %r, align 4
13  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %p, i8* align 8 %q, i32 24, i1 false)
14  br label %while.body
15
16while.body:                                       ; preds = %while.body, %entry
17  %load = load i32, i32* %r, align 4
18  %dec = add nsw i32 %load, -1
19  store i32 %dec, i32* %r, align 4
20  call void @g(%struct.T* %g)
21  %tobool = icmp eq i32 %dec, 0
22  br i1 %tobool, label %while.end, label %while.body
23
24while.end:                                        ; preds = %while.body
25  ret void
26}
27
28define void @f_pgso(i8* %p, i8* %q, i32* inalloca nocapture %unused) !prof !14 {
29entry:
30  %g = alloca %struct.T, align 8
31  %r = alloca i32, align 8
32  store i32 0, i32* %r, align 4
33  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %p, i8* align 8 %q, i32 24, i1 false)
34  br label %while.body
35
36while.body:                                       ; preds = %while.body, %entry
37  %load = load i32, i32* %r, align 4
38  %dec = add nsw i32 %load, -1
39  store i32 %dec, i32* %r, align 4
40  call void @g(%struct.T* %g)
41  %tobool = icmp eq i32 %dec, 0
42  br i1 %tobool, label %while.end, label %while.body
43
44while.end:                                        ; preds = %while.body
45  ret void
46}
47
48; Function Attrs: argmemonly nounwind
49declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #1
50
51declare void @g(%struct.T*)
52
53; CHECK-LABEL: _f:
54; CHECK:     pushl %ebp
55; CHECK:     movl %esp, %ebp
56; CHECK:     andl $-8, %esp
57; CHECK-NOT: movl %esp, %esi
58; CHECK:     rep;movsl
59; CHECK:     leal 8(%esp), %esi
60
61; CHECK:     decl     (%esp)
62; CHECK:     setne    %[[NE_REG:.*]]
63; CHECK:     pushl     %esi
64; CHECK:     calll     _g
65; CHECK:     addl     $4, %esp
66; CHECK:     testb    %[[NE_REG]], %[[NE_REG]]
67; CHECK:     jne
68
69; CHECK-LABEL: _f_pgso:
70; CHECK:     pushl %ebp
71; CHECK:     movl %esp, %ebp
72; CHECK:     andl $-8, %esp
73; CHECK-NOT: movl %esp, %esi
74; CHECK:     rep;movsl
75; CHECK:     leal 8(%esp), %esi
76
77; CHECK:     decl     (%esp)
78; CHECK:     setne    %[[NE_REG:.*]]
79; CHECK:     pushl     %esi
80; CHECK:     calll     _g
81; CHECK:     addl     $4, %esp
82; CHECK:     testb    %[[NE_REG]], %[[NE_REG]]
83; CHECK:     jne
84
85attributes #0 = { nounwind optsize }
86attributes #1 = { argmemonly nounwind }
87
88!llvm.module.flags = !{!0}
89!0 = !{i32 1, !"ProfileSummary", !1}
90!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
91!2 = !{!"ProfileFormat", !"InstrProf"}
92!3 = !{!"TotalCount", i64 10000}
93!4 = !{!"MaxCount", i64 10}
94!5 = !{!"MaxInternalCount", i64 1}
95!6 = !{!"MaxFunctionCount", i64 1000}
96!7 = !{!"NumCounts", i64 3}
97!8 = !{!"NumFunctions", i64 3}
98!9 = !{!"DetailedSummary", !10}
99!10 = !{!11, !12, !13}
100!11 = !{i32 10000, i64 100, i32 1}
101!12 = !{i32 999000, i64 100, i32 1}
102!13 = !{i32 999999, i64 1, i32 2}
103!14 = !{!"function_entry_count", i64 0}
104