llvm/test/CodeGen/ARM/2010-06-25-Thumb2ITInvalidIterator.ll
Duncan P. N. Exon Smith b056aa798d DebugInfo: Move new hierarchy into place
Move the specialized metadata nodes for the new debug info hierarchy
into place, finishing off PR22464.  I've done bootstraps (and all that)
and I'm confident this commit is NFC as far as DWARF output is
concerned.  Let me know if I'm wrong :).

The code changes are fairly mechanical:

  - Bumped the "Debug Info Version".
  - `DIBuilder` now creates the appropriate subclass of `MDNode`.
  - Subclasses of DIDescriptor now expect to hold their "MD"
    counterparts (e.g., `DIBasicType` expects `MDBasicType`).
  - Deleted a ton of dead code in `AsmWriter.cpp` and `DebugInfo.cpp`
    for printing comments.
  - Big update to LangRef to describe the nodes in the new hierarchy.
    Feel free to make it better.

Testcase changes are enormous.  There's an accompanying clang commit on
its way.

If you have out-of-tree debug info testcases, I just broke your build.

  - `upgrade-specialized-nodes.sh` is attached to PR22564.  I used it to
    update all the IR testcases.
  - Unfortunately I failed to find way to script the updates to CHECK
    lines, so I updated all of these by hand.  This was fairly painful,
    since the old CHECKs are difficult to reason about.  That's one of
    the benefits of the new hierarchy.

This work isn't quite finished, BTW.  The `DIDescriptor` subclasses are
almost empty wrappers, but not quite: they still have loose casting
checks (see the `RETURN_FROM_RAW()` macro).  Once they're completely
gutted, I'll rename the "MD" classes to "DI" and kill the wrappers.  I
also expect to make a few schema changes now that it's easier to reason
about everything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231082 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 17:24:31 +00:00

77 lines
4.4 KiB
LLVM

; RUN: llc < %s
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
target triple = "thumbv7-apple-darwin3.0.0-iphoneos"
@length = common global i32 0, align 4 ; <i32*> [#uses=1]
define void @x0(i8* nocapture %buf, i32 %nbytes) nounwind optsize {
entry:
tail call void @llvm.dbg.value(metadata i8* %buf, i64 0, metadata !0, metadata !MDExpression()), !dbg !15
tail call void @llvm.dbg.value(metadata i32 %nbytes, i64 0, metadata !8, metadata !MDExpression()), !dbg !16
%tmp = load i32, i32* @length, !dbg !17 ; <i32> [#uses=3]
%cmp = icmp eq i32 %tmp, -1, !dbg !17 ; <i1> [#uses=1]
%cmp.not = xor i1 %cmp, true ; <i1> [#uses=1]
%cmp3 = icmp ult i32 %tmp, %nbytes, !dbg !17 ; <i1> [#uses=1]
%or.cond = and i1 %cmp.not, %cmp3 ; <i1> [#uses=1]
tail call void @llvm.dbg.value(metadata i32 %tmp, i64 0, metadata !8, metadata !MDExpression()), !dbg !17
%nbytes.addr.0 = select i1 %or.cond, i32 %tmp, i32 %nbytes ; <i32> [#uses=1]
tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !10, metadata !MDExpression()), !dbg !19
br label %while.cond, !dbg !20
while.cond: ; preds = %while.body, %entry
%0 = phi i32 [ 0, %entry ], [ %inc, %while.body ] ; <i32> [#uses=3]
%buf.addr.0 = getelementptr i8, i8* %buf, i32 %0 ; <i8*> [#uses=1]
%cmp7 = icmp ult i32 %0, %nbytes.addr.0, !dbg !20 ; <i1> [#uses=1]
br i1 %cmp7, label %land.rhs, label %while.end, !dbg !20
land.rhs: ; preds = %while.cond
%call = tail call i32 @x1() nounwind optsize, !dbg !20 ; <i32> [#uses=2]
%cmp9 = icmp eq i32 %call, -1, !dbg !20 ; <i1> [#uses=1]
br i1 %cmp9, label %while.end, label %while.body, !dbg !20
while.body: ; preds = %land.rhs
%conv = trunc i32 %call to i8, !dbg !21 ; <i8> [#uses=1]
store i8 %conv, i8* %buf.addr.0, !dbg !21
%inc = add i32 %0, 1, !dbg !23 ; <i32> [#uses=1]
br label %while.cond, !dbg !24
while.end: ; preds = %land.rhs, %while.cond
ret void, !dbg !25
}
declare i32 @x1() optsize
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
!llvm.dbg.lv.fn = !{!0, !8, !10, !12}
!llvm.dbg.gv = !{!14}
!0 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "buf", line: 4, arg: 0, scope: !1, file: !2, type: !6)
!1 = !MDSubprogram(name: "x0", linkageName: "x0", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !26, scope: null, type: !4)
!2 = !MDFile(filename: "t.c", directory: "/private/tmp")
!3 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang 2.0", isOptimized: true, file: !26)
!4 = !MDSubroutineType(types: !5)
!5 = !{null}
!6 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !26, scope: !2, baseType: !7)
!7 = !MDBasicType(tag: DW_TAG_base_type, name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
!8 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "nbytes", line: 4, arg: 0, scope: !1, file: !2, type: !9)
!9 = !MDBasicType(tag: DW_TAG_base_type, name: "unsigned long", size: 32, align: 32, encoding: DW_ATE_unsigned)
!10 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "nread", line: 6, scope: !11, file: !2, type: !9)
!11 = distinct !MDLexicalBlock(line: 5, column: 1, file: !26, scope: !1)
!12 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "c", line: 7, scope: !11, file: !2, type: !13)
!13 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!14 = !MDGlobalVariable(name: "length", linkageName: "length", line: 1, isLocal: false, isDefinition: true, scope: !2, file: !2, type: !13, variable: i32* @length)
!15 = !MDLocation(line: 4, column: 24, scope: !1)
!16 = !MDLocation(line: 4, column: 43, scope: !1)
!17 = !MDLocation(line: 9, column: 2, scope: !11)
!18 = !{i32 0}
!19 = !MDLocation(line: 10, column: 2, scope: !11)
!20 = !MDLocation(line: 11, column: 2, scope: !11)
!21 = !MDLocation(line: 12, column: 3, scope: !22)
!22 = distinct !MDLexicalBlock(line: 11, column: 45, file: !26, scope: !11)
!23 = !MDLocation(line: 13, column: 3, scope: !22)
!24 = !MDLocation(line: 14, column: 2, scope: !22)
!25 = !MDLocation(line: 15, column: 1, scope: !11)
!26 = !MDFile(filename: "t.c", directory: "/private/tmp")