reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
# RUN: llc -o - %s -run-pass=shrink-wrap | FileCheck %s
--- |
  ; ModuleID = '<stdin>'
  source_filename = "t.c"
  target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
  target triple = "i386-pc-windows-msvc19.11.25508"
  
  ; Function Attrs: nounwind
  define x86_fastcallcc i32 @"@shrink_wrap_basic@16"(i32 inreg %a, i32 inreg %b, i32 %c, i32 %d) local_unnamed_addr #0 !dbg !8 {
  entry:
    %c.addr = alloca i32, align 4
    tail call void @llvm.dbg.value(metadata i32 %d, metadata !13, metadata !DIExpression()), !dbg !19
    tail call void @llvm.dbg.value(metadata i32 %c, metadata !14, metadata !DIExpression()), !dbg !20
    store i32 %c, i32* %c.addr, align 4, !tbaa !21
    tail call void @llvm.dbg.value(metadata i32 %b, metadata !15, metadata !DIExpression()), !dbg !25
    tail call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !26
    %cmp = icmp slt i32 %a, %b, !dbg !27
    br i1 %cmp, label %return, label %for.cond.preheader, !dbg !29
  
  for.cond.preheader:                               ; preds = %entry
    %0 = add i32 %c, -1, !dbg !30
    br label %for.cond, !dbg !30
  
  for.cond:                                         ; preds = %for.cond, %for.cond.preheader
    %lsr.iv = phi i32 [ %lsr.iv.next, %for.cond ], [ %0, %for.cond.preheader ]
    call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression()), !dbg !32
    call void @llvm.dbg.value(metadata i32* %c.addr, metadata !14, metadata !DIExpression()), !dbg !20
    %call = call i32 @doSomething(i32* nonnull %c.addr) #3, !dbg !33
    call void @llvm.dbg.value(metadata !2, metadata !17, metadata !DIExpression()), !dbg !32
    %lsr.iv.next = add i32 %lsr.iv, 1, !dbg !30
    %cmp1 = icmp slt i32 %lsr.iv.next, %d, !dbg !30
    br i1 %cmp1, label %for.cond, label %return, !dbg !34, !llvm.loop !35
  
  return:                                           ; preds = %for.cond, %entry
    %retval.0 = phi i32 [ %a, %entry ], [ %call, %for.cond ]
    ret i32 %retval.0, !dbg !37
  }
  
  declare i32 @doSomething(i32*) local_unnamed_addr
  
  ; Function Attrs: nounwind readnone speculatable
  declare void @llvm.dbg.value(metadata, metadata, metadata) #2
  
  ; Function Attrs: nounwind
  declare void @llvm.stackprotector(i8*, i8**) #3
  
  attributes #0 = { nounwind }
  attributes #2 = { nounwind readnone speculatable }
  attributes #3 = { nounwind }
  
  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3, !4, !5, !6}
  !llvm.ident = !{!7}
  
  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
  !1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "32f118fd5dd7e65ff7733c49b2f804ef")
  !2 = !{}
  !3 = !{i32 1, !"NumRegisterParameters", i32 0}
  !4 = !{i32 2, !"CodeView", i32 1}
  !5 = !{i32 2, !"Debug Info Version", i32 3}
  !6 = !{i32 1, !"wchar_size", i32 2}
  !7 = !{!"clang version 6.0.0 "}
  !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)
  !9 = !DISubroutineType(cc: DW_CC_BORLAND_msfastcall, types: !10)
  !10 = !{!11, !11, !11, !11, !11}
  !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !12 = !{!13, !14, !15, !16, !17}
  !13 = !DILocalVariable(name: "d", arg: 4, scope: !8, file: !1, line: 2, type: !11)
  !14 = !DILocalVariable(name: "c", arg: 3, scope: !8, file: !1, line: 2, type: !11)
  !15 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 2, type: !11)
  !16 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)
  !17 = !DILocalVariable(name: "i", scope: !18, file: !1, line: 5, type: !11)
  !18 = distinct !DILexicalBlock(scope: !8, file: !1, line: 5, column: 3)
  !19 = !DILocation(line: 2, column: 59, scope: !8)
  !20 = !DILocation(line: 2, column: 52, scope: !8)
  !21 = !{!22, !22, i64 0}
  !22 = !{!"int", !23, i64 0}
  !23 = !{!"omnipotent char", !24, i64 0}
  !24 = !{!"Simple C/C++ TBAA"}
  !25 = !DILocation(line: 2, column: 45, scope: !8)
  !26 = !DILocation(line: 2, column: 38, scope: !8)
  !27 = !DILocation(line: 3, column: 9, scope: !28)
  !28 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 7)
  !29 = !DILocation(line: 3, column: 7, scope: !8)
  !30 = !DILocation(line: 5, column: 21, scope: !31)
  !31 = distinct !DILexicalBlock(scope: !18, file: !1, line: 5, column: 3)
  !32 = !DILocation(line: 5, column: 12, scope: !18)
  !33 = !DILocation(line: 0, scope: !8)
  !34 = !DILocation(line: 5, column: 3, scope: !18)
  !35 = distinct !{!35, !34, !36}
  !36 = !DILocation(line: 6, column: 19, scope: !18)
  !37 = !DILocation(line: 8, column: 1, scope: !8)

...
---
name:            '@shrink_wrap_basic@16'
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:       
liveins:         
  - { reg: '$ecx', virtual-reg: '' }
  - { reg: '$edx', virtual-reg: '' }
frameInfo:       
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    4
  adjustsStack:    false
  hasCalls:        true
  stackProtector:  ''
  maxCallFrameSize: 4294967295
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  # CHECK: savePoint:       '%bb.1'
  # CHECK: restorePoint:    '%bb.3'
  savePoint:       ''
  restorePoint:    ''
fixedStack:      
  - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true }
  - { id: 1, type: default, offset: 0, size: 4, alignment: 4, stack-id: default,
      isImmutable: false, isAliased: false, callee-saved-register: '', 
      callee-saved-restored: true }
stack:           
constants:       
body:             |
  bb.0.entry:
    successors: %bb.4(0x40000000), %bb.1(0x40000000)
    liveins: $ecx, $edx
  
    DBG_VALUE $edx, $noreg, !15, !DIExpression(), debug-location !25
    DBG_VALUE $ecx, $noreg, !16, !DIExpression(), debug-location !26
    $eax = COPY $ecx
    DBG_VALUE %fixed-stack.0, 0, !16, !DIExpression(), debug-location !26
    DBG_VALUE %fixed-stack.1, 0, !15, !DIExpression(), debug-location !25
    CMP32rr $eax, killed $edx, implicit-def $eflags, debug-location !27
    JCC_1 %bb.4, 12, implicit killed $eflags, debug-location !29
    JMP_1 %bb.1, debug-location !29
  
  bb.1.for.cond.preheader:
    successors: %bb.2(0x80000000)
  
    $esi = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (load 4 from %fixed-stack.0)
    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !19
    $edi = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (load 4 from %fixed-stack.1)
    DBG_VALUE $edi, $noreg, !14, !DIExpression(), debug-location !20
    $edi = DEC32r killed $edi, implicit-def dead $eflags, debug-location !30
    $ebx = LEA32r %fixed-stack.1, 1, $noreg, 0, $noreg
  
  bb.2.for.cond:
    successors: %bb.2(0x7c000000), %bb.3(0x04000000)
    liveins: $ebx, $edi, $esi
  
    ADJCALLSTACKDOWN32 4, 0, 4, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp, debug-location !33
    DBG_VALUE %fixed-stack.1, 0, !14, !DIExpression(), debug-location !20
    PUSH32r $ebx, implicit-def $esp, implicit $esp, debug-location !33
    CFI_INSTRUCTION adjust_cfa_offset 4, debug-location !33
    CALLpcrel32 @doSomething, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp, implicit-def $eax, debug-location !33
    ADJCALLSTACKUP32 4, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp, debug-location !33
    $edi = INC32r killed $edi, implicit-def dead $eflags, debug-location !30
    CMP32rr $edi, $esi, implicit-def $eflags, debug-location !30
    JCC_1 %bb.2, 12, implicit killed $eflags, debug-location !34
  
  bb.3:
    successors: %bb.4(0x80000000)
    liveins: $eax
  
  
  bb.4.return:
    liveins: $eax
  
    RET 8, $eax, debug-location !37

...