1 # RUN: llc -o - %s -run-pass=shrink-wrap | FileCheck %s
4 source_filename = "t.c"
5 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
6 target triple = "i386-pc-windows-msvc19.11.25508"
8 ; Function Attrs: nounwind
9 define x86_fastcallcc i32 @"@shrink_wrap_basic@16"(i32 inreg %a, i32 inreg %b, i32 %c, i32 %d) local_unnamed_addr #0 !dbg !8 {
11 %c.addr = alloca i32, align 4
12 tail call void @llvm.dbg.value(metadata i32 %d, metadata !13, metadata !DIExpression()), !dbg !19
13 tail call void @llvm.dbg.value(metadata i32 %c, metadata !14, metadata !DIExpression()), !dbg !20
14 store i32 %c, ptr %c.addr, align 4, !tbaa !21
15 tail call void @llvm.dbg.value(metadata i32 %b, metadata !15, metadata !DIExpression()), !dbg !25
16 tail call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !26
17 %cmp = icmp slt i32 %a, %b, !dbg !27
18 br i1 %cmp, label %return, label %for.cond.preheader, !dbg !29
20 for.cond.preheader: ; preds = %entry
21 %0 = add i32 %c, -1, !dbg !30
22 br label %for.cond, !dbg !30
24 for.cond: ; preds = %for.cond, %for.cond.preheader
25 %lsr.iv = phi i32 [ %lsr.iv.next, %for.cond ], [ %0, %for.cond.preheader ]
26 call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression()), !dbg !32
27 call void @llvm.dbg.value(metadata ptr %c.addr, metadata !14, metadata !DIExpression()), !dbg !20
28 %call = call i32 @doSomething(ptr nonnull %c.addr) #3, !dbg !33
29 call void @llvm.dbg.value(metadata !2, metadata !17, metadata !DIExpression()), !dbg !32
30 %lsr.iv.next = add i32 %lsr.iv, 1, !dbg !30
31 %cmp1 = icmp slt i32 %lsr.iv.next, %d, !dbg !30
32 br i1 %cmp1, label %for.cond, label %return, !dbg !34, !llvm.loop !35
34 return: ; preds = %for.cond, %entry
35 %retval.0 = phi i32 [ %a, %entry ], [ %call, %for.cond ]
36 ret i32 %retval.0, !dbg !37
39 declare i32 @doSomething(ptr) local_unnamed_addr
41 ; Function Attrs: nounwind readnone speculatable
42 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
44 ; Function Attrs: nounwind
45 declare void @llvm.stackprotector(ptr, ptr) #3
47 attributes #0 = { nounwind }
48 attributes #2 = { nounwind readnone speculatable }
49 attributes #3 = { nounwind }
52 !llvm.module.flags = !{!3, !4, !5, !6}
55 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
56 !1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "32f118fd5dd7e65ff7733c49b2f804ef")
58 !3 = !{i32 1, !"NumRegisterParameters", i32 0}
59 !4 = !{i32 2, !"CodeView", i32 1}
60 !5 = !{i32 2, !"Debug Info Version", i32 3}
61 !6 = !{i32 1, !"wchar_size", i32 2}
62 !7 = !{!"clang version 6.0.0 "}
63 !8 = distinct !DISubprogram(name: "shrink_wrap_basic", linkageName: "\01@shrink_wrap_basic@16", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
64 !9 = !DISubroutineType(cc: DW_CC_BORLAND_msfastcall, types: !10)
65 !10 = !{!11, !11, !11, !11, !11}
66 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
67 !12 = !{!13, !14, !15, !16, !17}
68 !13 = !DILocalVariable(name: "d", arg: 4, scope: !8, file: !1, line: 2, type: !11)
69 !14 = !DILocalVariable(name: "c", arg: 3, scope: !8, file: !1, line: 2, type: !11)
70 !15 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 2, type: !11)
71 !16 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)
72 !17 = !DILocalVariable(name: "i", scope: !18, file: !1, line: 5, type: !11)
73 !18 = distinct !DILexicalBlock(scope: !8, file: !1, line: 5, column: 3)
74 !19 = !DILocation(line: 2, column: 59, scope: !8)
75 !20 = !DILocation(line: 2, column: 52, scope: !8)
76 !21 = !{!22, !22, i64 0}
77 !22 = !{!"int", !23, i64 0}
78 !23 = !{!"omnipotent char", !24, i64 0}
79 !24 = !{!"Simple C/C++ TBAA"}
80 !25 = !DILocation(line: 2, column: 45, scope: !8)
81 !26 = !DILocation(line: 2, column: 38, scope: !8)
82 !27 = !DILocation(line: 3, column: 9, scope: !28)
83 !28 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 7)
84 !29 = !DILocation(line: 3, column: 7, scope: !8)
85 !30 = !DILocation(line: 5, column: 21, scope: !31)
86 !31 = distinct !DILexicalBlock(scope: !18, file: !1, line: 5, column: 3)
87 !32 = !DILocation(line: 5, column: 12, scope: !18)
88 !33 = !DILocation(line: 0, scope: !8)
89 !34 = !DILocation(line: 5, column: 3, scope: !18)
90 !35 = distinct !{!35, !34, !36}
91 !36 = !DILocation(line: 6, column: 19, scope: !18)
92 !37 = !DILocation(line: 8, column: 1, scope: !8)
96 name: '@shrink_wrap_basic@16'
98 exposesReturnsTwice: false
100 regBankSelected: false
102 tracksRegLiveness: true
105 - { reg: '$ecx', virtual-reg: '' }
106 - { reg: '$edx', virtual-reg: '' }
108 isFrameAddressTaken: false
109 isReturnAddressTaken: false
118 maxCallFrameSize: 4294967295
119 hasOpaqueSPAdjustment: false
121 hasMustTailInVarArgFunc: false
122 # CHECK: savePoint: '%bb.1'
123 # CHECK: restorePoint: '%bb.3'
127 - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default,
128 isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true }
129 - { id: 1, type: default, offset: 0, size: 4, alignment: 4, stack-id: default,
130 isImmutable: false, isAliased: false, callee-saved-register: '',
131 callee-saved-restored: true }
136 successors: %bb.4(0x40000000), %bb.1(0x40000000)
139 DBG_VALUE $edx, $noreg, !15, !DIExpression(), debug-location !25
140 DBG_VALUE $ecx, $noreg, !16, !DIExpression(), debug-location !26
142 DBG_VALUE %fixed-stack.0, 0, !16, !DIExpression(), debug-location !26
143 DBG_VALUE %fixed-stack.1, 0, !15, !DIExpression(), debug-location !25
144 CMP32rr $eax, killed $edx, implicit-def $eflags, debug-location !27
145 JCC_1 %bb.4, 12, implicit killed $eflags, debug-location !29
146 JMP_1 %bb.1, debug-location !29
148 bb.1.for.cond.preheader:
149 successors: %bb.2(0x80000000)
151 $esi = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.0)
152 DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !19
153 $edi = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.1)
154 DBG_VALUE $edi, $noreg, !14, !DIExpression(), debug-location !20
155 $edi = DEC32r killed $edi, implicit-def dead $eflags, debug-location !30
156 $ebx = LEA32r %fixed-stack.1, 1, $noreg, 0, $noreg
159 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
160 liveins: $ebx, $edi, $esi
162 ADJCALLSTACKDOWN32 4, 0, 4, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp, debug-location !33
163 DBG_VALUE %fixed-stack.1, 0, !14, !DIExpression(), debug-location !20
164 PUSH32r $ebx, implicit-def $esp, implicit $esp, debug-location !33
165 CFI_INSTRUCTION adjust_cfa_offset 4, debug-location !33
166 CALLpcrel32 @doSomething, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp, implicit-def $eax, debug-location !33
167 ADJCALLSTACKUP32 4, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp, debug-location !33
168 $edi = INC32r killed $edi, implicit-def dead $eflags, debug-location !30
169 CMP32rr $edi, $esi, implicit-def $eflags, debug-location !30
170 JCC_1 %bb.2, 12, implicit killed $eflags, debug-location !34
173 successors: %bb.4(0x80000000)
180 RET 8, $eax, debug-location !37