brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.3 KiB · 52cbcf2 Raw
186 lines · plain
1# RUN: llc -o - %s -run-pass=shrink-wrap | FileCheck %s2# RUN: llc -o - %s -passes='shrink-wrap' | FileCheck %s3--- |4  ; ModuleID = '<stdin>'5  source_filename = "t.c"6  target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"7  target triple = "i386-pc-windows-msvc19.11.25508"8  9  ; Function Attrs: nounwind10  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  entry:12    %c.addr = alloca i32, align 413    tail call void @llvm.dbg.value(metadata i32 %d, metadata !13, metadata !DIExpression()), !dbg !1914    tail call void @llvm.dbg.value(metadata i32 %c, metadata !14, metadata !DIExpression()), !dbg !2015    store i32 %c, ptr %c.addr, align 4, !tbaa !2116    tail call void @llvm.dbg.value(metadata i32 %b, metadata !15, metadata !DIExpression()), !dbg !2517    tail call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !2618    %cmp = icmp slt i32 %a, %b, !dbg !2719    br i1 %cmp, label %return, label %for.cond.preheader, !dbg !2920  21  for.cond.preheader:                               ; preds = %entry22    %0 = add i32 %c, -1, !dbg !3023    br label %for.cond, !dbg !3024  25  for.cond:                                         ; preds = %for.cond, %for.cond.preheader26    %lsr.iv = phi i32 [ %lsr.iv.next, %for.cond ], [ %0, %for.cond.preheader ]27    call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression()), !dbg !3228    call void @llvm.dbg.value(metadata ptr %c.addr, metadata !14, metadata !DIExpression()), !dbg !2029    %call = call i32 @doSomething(ptr nonnull %c.addr) #3, !dbg !3330    call void @llvm.dbg.value(metadata !2, metadata !17, metadata !DIExpression()), !dbg !3231    %lsr.iv.next = add i32 %lsr.iv, 1, !dbg !3032    %cmp1 = icmp slt i32 %lsr.iv.next, %d, !dbg !3033    br i1 %cmp1, label %for.cond, label %return, !dbg !34, !llvm.loop !3534  35  return:                                           ; preds = %for.cond, %entry36    %retval.0 = phi i32 [ %a, %entry ], [ %call, %for.cond ]37    ret i32 %retval.0, !dbg !3738  }39  40  declare i32 @doSomething(ptr) local_unnamed_addr41  42  ; Function Attrs: nounwind readnone speculatable43  declare void @llvm.dbg.value(metadata, metadata, metadata) #244  45  ; Function Attrs: nounwind46  declare void @llvm.stackprotector(ptr, ptr) #347  48  attributes #0 = { nounwind }49  attributes #2 = { nounwind readnone speculatable }50  attributes #3 = { nounwind }51  52  !llvm.dbg.cu = !{!0}53  !llvm.module.flags = !{!3, !4, !5, !6}54  !llvm.ident = !{!7}55  56  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)57  !1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "32f118fd5dd7e65ff7733c49b2f804ef")58  !2 = !{}59  !3 = !{i32 1, !"NumRegisterParameters", i32 0}60  !4 = !{i32 2, !"CodeView", i32 1}61  !5 = !{i32 2, !"Debug Info Version", i32 3}62  !6 = !{i32 1, !"wchar_size", i32 2}63  !7 = !{!"clang version 6.0.0 "}64  !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)65  !9 = !DISubroutineType(cc: DW_CC_BORLAND_msfastcall, types: !10)66  !10 = !{!11, !11, !11, !11, !11}67  !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)68  !12 = !{!13, !14, !15, !16, !17}69  !13 = !DILocalVariable(name: "d", arg: 4, scope: !8, file: !1, line: 2, type: !11)70  !14 = !DILocalVariable(name: "c", arg: 3, scope: !8, file: !1, line: 2, type: !11)71  !15 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 2, type: !11)72  !16 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)73  !17 = !DILocalVariable(name: "i", scope: !18, file: !1, line: 5, type: !11)74  !18 = distinct !DILexicalBlock(scope: !8, file: !1, line: 5, column: 3)75  !19 = !DILocation(line: 2, column: 59, scope: !8)76  !20 = !DILocation(line: 2, column: 52, scope: !8)77  !21 = !{!22, !22, i64 0}78  !22 = !{!"int", !23, i64 0}79  !23 = !{!"omnipotent char", !24, i64 0}80  !24 = !{!"Simple C/C++ TBAA"}81  !25 = !DILocation(line: 2, column: 45, scope: !8)82  !26 = !DILocation(line: 2, column: 38, scope: !8)83  !27 = !DILocation(line: 3, column: 9, scope: !28)84  !28 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 7)85  !29 = !DILocation(line: 3, column: 7, scope: !8)86  !30 = !DILocation(line: 5, column: 21, scope: !31)87  !31 = distinct !DILexicalBlock(scope: !18, file: !1, line: 5, column: 3)88  !32 = !DILocation(line: 5, column: 12, scope: !18)89  !33 = !DILocation(line: 0, scope: !8)90  !34 = !DILocation(line: 5, column: 3, scope: !18)91  !35 = distinct !{!35, !34, !36}92  !36 = !DILocation(line: 6, column: 19, scope: !18)93  !37 = !DILocation(line: 8, column: 1, scope: !8)94 95...96---97name:            '@shrink_wrap_basic@16'98alignment:       1699exposesReturnsTwice: false100legalized:       false101regBankSelected: false102selected:        false103tracksRegLiveness: true104registers:       105liveins:         106  - { reg: '$ecx', virtual-reg: '' }107  - { reg: '$edx', virtual-reg: '' }108frameInfo:       109  isFrameAddressTaken: false110  isReturnAddressTaken: false111  hasStackMap:     false112  hasPatchPoint:   false113  stackSize:       0114  offsetAdjustment: 0115  maxAlignment:    4116  adjustsStack:    false117  hasCalls:        true118  stackProtector:  ''119  maxCallFrameSize: 4294967295120  hasOpaqueSPAdjustment: false121  hasVAStart:      false122  hasMustTailInVarArgFunc: false123  # CHECK:      savePoint:124  # CHECK-NEXT:   - point:           '%bb.1'125  # CHECK:      restorePoint:126  # CHECK-NEXT:   - point:           '%bb.3'127  savePoint:       []128  restorePoint:    []129fixedStack:      130  - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default,131      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true }132  - { id: 1, type: default, offset: 0, size: 4, alignment: 4, stack-id: default,133      isImmutable: false, isAliased: false, callee-saved-register: '', 134      callee-saved-restored: true }135stack:           136constants:       137body:             |138  bb.0.entry:139    successors: %bb.4(0x40000000), %bb.1(0x40000000)140    liveins: $ecx, $edx141  142    DBG_VALUE $edx, $noreg, !15, !DIExpression(), debug-location !25143    DBG_VALUE $ecx, $noreg, !16, !DIExpression(), debug-location !26144    $eax = COPY $ecx145    DBG_VALUE %fixed-stack.0, 0, !16, !DIExpression(), debug-location !26146    DBG_VALUE %fixed-stack.1, 0, !15, !DIExpression(), debug-location !25147    CMP32rr $eax, killed $edx, implicit-def $eflags, debug-location !27148    JCC_1 %bb.4, 12, implicit killed $eflags, debug-location !29149    JMP_1 %bb.1, debug-location !29150  151  bb.1.for.cond.preheader:152    successors: %bb.2(0x80000000)153  154    $esi = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.0)155    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !19156    $edi = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.1)157    DBG_VALUE $edi, $noreg, !14, !DIExpression(), debug-location !20158    $edi = DEC32r killed $edi, implicit-def dead $eflags, debug-location !30159    $ebx = LEA32r %fixed-stack.1, 1, $noreg, 0, $noreg160  161  bb.2.for.cond:162    successors: %bb.2(0x7c000000), %bb.3(0x04000000)163    liveins: $ebx, $edi, $esi164  165    ADJCALLSTACKDOWN32 4, 0, 4, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp, debug-location !33166    DBG_VALUE %fixed-stack.1, 0, !14, !DIExpression(), debug-location !20167    PUSH32r $ebx, implicit-def $esp, implicit $esp, debug-location !33168    CFI_INSTRUCTION adjust_cfa_offset 4, debug-location !33169    CALLpcrel32 @doSomething, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp, implicit-def $eax, debug-location !33170    ADJCALLSTACKUP32 4, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp, debug-location !33171    $edi = INC32r killed $edi, implicit-def dead $eflags, debug-location !30172    CMP32rr $edi, $esi, implicit-def $eflags, debug-location !30173    JCC_1 %bb.2, 12, implicit killed $eflags, debug-location !34174  175  bb.3:176    successors: %bb.4(0x80000000)177    liveins: $eax178  179  180  bb.4.return:181    liveins: $eax182  183    RET 8, $eax, debug-location !37184 185...186