brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.6 KiB · e0c8964 Raw
166 lines · plain
1# RUN: llc -emit-call-site-info -mtriple=arm-linux-gnu -debug-entry-values -run-pass if-converter %s -o -| FileCheck %s2 3# Vefify that the call site info will be updated after the optimization.4# This test case would previously trigger an assertion when5# deleting the call instruction.6 7# Test case is generated from:8# extern void9# foo (int* seg, int subseg);10# extern int* mri_common_symbol;11#12# void13# baa (int* secptr, int subseg)14# {15#   if (! (secptr == 0 && subseg == 0))16#     foo (secptr, subseg);17#   mri_common_symbol = 0;18# }19#20# With slight change of MIR - substitution of BL instruction with BL_pred 21# in order to trigger optimization.22# clang -target arm-linux-gnu -g -O2 -Xclang -femit-debug-entry-values 23#       %s -stop-before=if-convert24#25# CHECK: callSites:26# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs:27# CHECK-NEXT:     - { arg: 0, reg: '$r0' }28# CHECK-NEXT:     - { arg: 1, reg: '$r1' } }29 30--- |31  ; ModuleID = 'if-convert-call-site-info.c'32  source_filename = "if-convert-call-site-info.c"33  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"34  target triple = "armv6kz-unknown-linux-gnueabihf"35  36  @mri_common_symbol = external dso_local local_unnamed_addr global ptr, align 437  38  ; Function Attrs: nounwind39  define dso_local void @baa(ptr %secptr, i32 %subseg) local_unnamed_addr #0 !dbg !14 {40  entry:41    call void @llvm.dbg.value(metadata ptr %secptr, metadata !16, metadata !DIExpression()), !dbg !1842    call void @llvm.dbg.value(metadata i32 %subseg, metadata !17, metadata !DIExpression()), !dbg !1843    %cmp = icmp eq ptr %secptr, null, !dbg !1944    %cmp1 = icmp eq i32 %subseg, 0, !dbg !2145    %or.cond = and i1 %cmp, %cmp1, !dbg !2246    br i1 %or.cond, label %if.end, label %if.then, !dbg !2247  48  if.then:                                          ; preds = %entry49    tail call void @foo(ptr %secptr, i32 %subseg), !dbg !2350    br label %if.end, !dbg !2351  52  if.end:                                           ; preds = %entry, %if.then53    store ptr null, ptr @mri_common_symbol, align 4, !dbg !24, !tbaa !2554    ret void, !dbg !2955  }56  57  declare !dbg !4 dso_local void @foo(ptr, i32) local_unnamed_addr58  59  ; Function Attrs: nounwind readnone speculatable willreturn60  declare void @llvm.dbg.value(metadata, metadata, metadata)61  62  ; Function Attrs: nounwind63  declare void @llvm.stackprotector(ptr, ptr)64  65  attributes #0 = { "frame-pointer"="all" }66  67  !llvm.dbg.cu = !{!0}68  !llvm.module.flags = !{!9, !10, !11, !12}69  !llvm.ident = !{!13}70  71  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)72  !1 = !DIFile(filename: "if-convert-call-site-info.c", directory: "/")73  !2 = !{}74  !3 = !{!4}75  !4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 10, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)76  !5 = !DISubroutineType(types: !6)77  !6 = !{null, !7, !8}78  !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 32)79  !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)80  !9 = !{i32 2, !"Dwarf Version", i32 4}81  !10 = !{i32 2, !"Debug Info Version", i32 3}82  !11 = !{i32 1, !"wchar_size", i32 4}83  !12 = !{i32 1, !"min_enum_size", i32 4}84  !13 = !{!"clang version 10.0.0 "}85  !14 = distinct !DISubprogram(name: "baa", scope: !1, file: !1, line: 14, type: !5, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)86  !15 = !{!16, !17}87  !16 = !DILocalVariable(name: "secptr", arg: 1, scope: !14, file: !1, line: 14, type: !7)88  !17 = !DILocalVariable(name: "subseg", arg: 2, scope: !14, file: !1, line: 14, type: !8)89  !18 = !DILocation(line: 0, scope: !14)90  !19 = !DILocation(line: 16, column: 17, scope: !20)91  !20 = distinct !DILexicalBlock(scope: !14, file: !1, line: 16, column: 7)92  !21 = !DILocation(line: 16, column: 32, scope: !20)93  !22 = !DILocation(line: 16, column: 22, scope: !20)94  !23 = !DILocation(line: 17, column: 5, scope: !20)95  !24 = !DILocation(line: 18, column: 21, scope: !14)96  !25 = !{!26, !26, i64 0}97  !26 = !{!"any pointer", !27, i64 0}98  !27 = !{!"omnipotent char", !28, i64 0}99  !28 = !{!"Simple C/C++ TBAA"}100  !29 = !DILocation(line: 19, column: 1, scope: !14)101 102...103---104name:            baa105alignment:       2106tracksRegLiveness: true107liveins:108  - { reg: '$r0' }109  - { reg: '$r1' }110frameInfo:111  stackSize:       8112  maxAlignment:    4113  adjustsStack:    true114  hasCalls:        true115  maxCallFrameSize: 0116stack:117  - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, callee-saved-register: '$lr', 118      callee-saved-restored: false }119  - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, callee-saved-register: '$r11' }120callSites:121  - { bb: 2, offset: 0, fwdArgRegs: 122      - { arg: 0, reg: '$r0' }123      - { arg: 1, reg: '$r1' } }124constants:125  - id:              0126    value:           'ptr null'127    alignment:       4128machineFunctionInfo: {}129body:             |130  bb.0.entry:131    successors: %bb.1(0x60000000), %bb.2(0x20000000)132    liveins: $r0, $r1, $lr133  134    DBG_VALUE $r0, $noreg, !16, !DIExpression(), debug-location !18135    DBG_VALUE $r0, $noreg, !16, !DIExpression(), debug-location !18136    DBG_VALUE $r1, $noreg, !17, !DIExpression(), debug-location !18137    DBG_VALUE $r1, $noreg, !17, !DIExpression(), debug-location !18138    $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r11, killed $lr139    frame-setup CFI_INSTRUCTION def_cfa_offset 8140    frame-setup CFI_INSTRUCTION offset $lr, -4141    frame-setup CFI_INSTRUCTION offset $r11, -8142    $r11 = frame-setup MOVr killed $sp, 14, $noreg, $noreg143    frame-setup CFI_INSTRUCTION def_cfa_register $r11144    CMPri renamable $r0, 0, 14, $noreg, implicit-def $cpsr, debug-location !22145    Bcc %bb.2, 1, killed $cpsr, debug-location !22146  147  bb.1.entry:148    successors: %bb.3(0x55555555), %bb.2(0x2aaaaaab)149    liveins: $r0, $r1150  151    CMPri renamable $r1, 0, 14, $noreg, implicit-def $cpsr, debug-location !22152    Bcc %bb.3, 0, killed $cpsr, debug-location !22153  154  bb.2.if.then:155    liveins: $r0, $r1156  157    BL_pred @foo, 14, $noreg, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $sp, debug-location !23158  159  bb.3.if.end:160    renamable $r0 = LDRi12 %const.0, 0, 14, $noreg, debug-location !24 :: (load (s32) from constant-pool)161    renamable $r1 = MOVi 0, 14, $noreg, $noreg162    STRi12 killed renamable $r1, killed renamable $r0, 0, 14, $noreg, debug-location !24 :: (store (s32) into @mri_common_symbol, !tbaa !25)163    $sp = LDMIA_RET $sp, 14, $noreg, def $r11, def $pc, debug-location !29164 165...166