mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-05 02:16:46 +00:00
4eeaa0da04
Currently each Function points to a DISubprogram and DISubprogram has a scope field. For member functions the scope is a DICompositeType. DIScopes point to the DICompileUnit to facilitate type uniquing. Distinct DISubprograms (with isDefinition: true) are not part of the type hierarchy and cannot be uniqued. This change removes the subprograms list from DICompileUnit and instead adds a pointer to the owning compile unit to distinct DISubprograms. This would make it easy for ThinLTO to strip unneeded DISubprograms and their transitively referenced debug info. Motivation ---------- Materializing DISubprograms is currently the most expensive operation when doing a ThinLTO build of clang. We want the DISubprogram to be stored in a separate Bitcode block (or the same block as the function body) so we can avoid having to expensively deserialize all DISubprograms together with the global metadata. If a function has been inlined into another subprogram we need to store a reference the block containing the inlined subprogram. Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script that updates LLVM IR testcases to the new format. http://reviews.llvm.org/D19034 <rdar://problem/25256815> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266446 91177308-0d34-0410-b5e6-96231b3b80d8
73 lines
3.6 KiB
LLVM
73 lines
3.6 KiB
LLVM
; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-count=2 | FileCheck %s -check-prefix=EPILOG
|
|
; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
|
|
|
|
; This tests that setting the unroll count works
|
|
|
|
|
|
; EPILOG: for.body.preheader:
|
|
; EPILOG: br i1 %lcmp.mod, label %for.body.preheader.new, label %for.end.loopexit.unr-lcssa, !dbg [[PH_LOC:![0-9]+]]
|
|
; EPILOG: for.body:
|
|
; EPILOG: br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !dbg [[BODY_LOC:![0-9]+]]
|
|
; EPILOG-NOT: br i1 %niter.ncmp.2, label %for.end.loopexit{{.*}}, label %for.body
|
|
; EPILOG: for.body.epil.preheader:
|
|
; EPILOG: br label %for.body.epil, !dbg [[EXIT_LOC:![0-9]+]]
|
|
; EPILOG: for.body.epil:
|
|
; EPILOG: br label %for.end.loopexit.epilog-lcssa, !dbg [[BODY_LOC:![0-9]+]]
|
|
|
|
; EPILOG-DAG: [[PH_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}})
|
|
; EPILOG-DAG: [[BODY_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}})
|
|
; EPILOG-DAG: [[EXIT_LOC]] = !DILocation(line: 103, column: 1, scope: !{{.*}})
|
|
|
|
; PROLOG: for.body.preheader:
|
|
; PROLOG: br {{.*}} label %for.body.prol.preheader, label %for.body.prol.loopexit, !dbg [[PH_LOC:![0-9]+]]
|
|
; PROLOG: for.body.prol:
|
|
; PROLOG: br label %for.body.prol.loopexit, !dbg [[BODY_LOC:![0-9]+]]
|
|
; PROLOG: for.body.prol.loopexit:
|
|
; PROLOG: br {{.*}} label %for.end.loopexit, label %for.body.preheader.new, !dbg [[PH_LOC]]
|
|
; PROLOG: for.body:
|
|
; PROLOG: br i1 %exitcond.1, label %for.end.loopexit.unr-lcssa, label %for.body, !dbg [[BODY_LOC]]
|
|
; PROLOG-NOT: br i1 %exitcond.4, label %for.end.loopexit{{.*}}, label %for.body
|
|
|
|
; PROLOG-DAG: [[PH_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}})
|
|
; PROLOG-DAG: [[BODY_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}})
|
|
|
|
define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly !dbg !6 {
|
|
entry:
|
|
%cmp1 = icmp eq i32 %n, 0, !dbg !7
|
|
br i1 %cmp1, label %for.end, label %for.body, !dbg !7
|
|
|
|
for.body: ; preds = %for.body, %entry
|
|
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
|
|
%sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
|
|
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv, !dbg !8
|
|
%0 = load i32, i32* %arrayidx, align 4, !dbg !8
|
|
%add = add nsw i32 %0, %sum.02, !dbg !8
|
|
%indvars.iv.next = add i64 %indvars.iv, 1, !dbg !9
|
|
%lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !9
|
|
%exitcond = icmp eq i32 %lftr.wideiv, %n, !dbg !9
|
|
br i1 %exitcond, label %for.end, label %for.body, !dbg !9
|
|
|
|
for.end: ; preds = %for.body, %entry
|
|
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
|
|
ret i32 %sum.0.lcssa, !dbg !10
|
|
}
|
|
|
|
!llvm.module.flags = !{!0, !1, !2}
|
|
!llvm.dbg.cu = !{!11}
|
|
!0 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!2 = !{i32 1, !"PIC Level", i32 2}
|
|
|
|
!3 = !{}
|
|
!4 = !DISubroutineType(types: !3)
|
|
!5 = !DIFile(filename: "test.cpp", directory: "/tmp")
|
|
!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, unit: !11, variables: !3)
|
|
!7 = !DILocation(line: 100, column: 1, scope: !6)
|
|
!8 = !DILocation(line: 101, column: 1, scope: !6)
|
|
!9 = !DILocation(line: 102, column: 1, scope: !6)
|
|
!10 = !DILocation(line: 103, column: 1, scope: !6)
|
|
!11 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
|
|
file: !5,
|
|
isOptimized: true, flags: "-O2",
|
|
splitDebugFilename: "abc.debug", emissionKind: 2)
|