# RUN: sed -e 's/STACK_EXPR//g' -e 's/BODY_EXPR//g' %s | llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-NONE %s # RUN: sed -e 's/STACK_EXPR/DW_OP_LLVM_arg, 0, DW_OP_dup, DW_OP_plus/g' -e 's/BODY_EXPR/DW_OP_LLVM_arg, 0, DW_OP_dup, DW_OP_plus/g' %s \ # RUN: | llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-SOME %s # RUN: sed -e 's/STACK_EXPR/DW_OP_foobar/g' -e 's/BODY_EXPR//g' %s | not llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-ERR-STACK-INVALID-OP %s # RUN: sed -e 's/STACK_EXPR//g' -e 's/BODY_EXPR/DW_OP_foobar/g' %s | not llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-ERR-BODY-INVALID-OP %s # RUN: sed -e 's/STACK_EXPR/DW_ATE_foobar/g' -e 's/BODY_EXPR//g' %s | not llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-ERR-STACK-INVALID-ATTR %s # RUN: sed -e 's/STACK_EXPR//g' -e 's/BODY_EXPR/DW_ATE_foobar/g' %s | not llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-ERR-BODY-INVALID-ATTR %s # RUN: sed -e 's/STACK_EXPR/foobar/g' -e 's/BODY_EXPR//g' %s | not llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-ERR-STACK-INVALID-INT %s # RUN: sed -e 's/STACK_EXPR//g' -e 's/BODY_EXPR/foobar/g' %s | not llc -x mir -run-pass none -o - 2>&1 | FileCheck --check-prefix=EXPR-ERR-BODY-INVALID-INT %s # Test that we successfully parse valid DIExpression metadata in MIR, and that # we reject invalid DIExpression metadata in MIR. --- | define void @func() #0 !dbg !6 { entry: call void @llvm.dbg.value(metadata i32 0, metadata !10, metadata !DIExpression()), !dbg !12 ret void } declare void @llvm.dbg.value(metadata, metadata, metadata) #1 attributes #0 = { noinline nounwind optnone } attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } !llvm.module.flags = !{!0, !1} !llvm.ident = !{!2} !llvm.dbg.cu = !{!3} !llvm.debugify = !{!5, !5} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 2, !"Debug Info Version", i32 3} !2 = !{!"clang"} !3 = distinct !DICompileUnit(language: DW_LANG_C, file: !4, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) !4 = !DIFile(filename: "", directory: "/") !5 = !{i32 1} !6 = distinct !DISubprogram(name: "func", linkageName: "func", scope: null, file: !4, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !3, retainedNodes: !9) !7 = !DISubroutineType(types: !8) !8 = !{} !9 = !{!10} !10 = !DILocalVariable(name: "1", scope: !6, file: !4, line: 1, type: !11) !11 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) !12 = !DILocation(line: 1, column: 1, scope: !6) ... --- # EXPR-NONE: debug-info-expression: '!DIExpression()' # EXPR-NONE: DBG_VALUE 0, 0, ![[#]], !DIExpression(), debug-location ![[#]] # EXPR-SOME: debug-info-expression: '!DIExpression(DW_OP_LLVM_arg, 0, DW_OP_dup, DW_OP_plus)' # EXPR-SOME: DBG_VALUE 0, 0, ![[#]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_dup, DW_OP_plus), debug-location ![[#]] name: func stack: # EXPR-ERR-STACK-INVALID-OP: :[[#@LINE+4]]:45: invalid DWARF op 'DW_OP_foobar' # EXPR-ERR-STACK-INVALID-ATTR: :[[#@LINE+3]]:45: invalid DWARF attribute encoding 'DW_ATE_foobar' # EXPR-ERR-STACK-INVALID-INT: :[[#@LINE+2]]:45: expected unsigned integer - { id: 0, size: 4, debug-info-variable: '!10', debug-info-location: '!12', debug-info-expression: '!DIExpression(STACK_EXPR)' } body: | bb.0.entry: ; EXPR-ERR-BODY-INVALID-OP: :[[#@LINE+3]]:40: invalid DWARF op 'DW_OP_foobar' ; EXPR-ERR-BODY-INVALID-ATTR: :[[#@LINE+2]]:40: invalid DWARF attribute encoding 'DW_ATE_foobar' ; EXPR-ERR-BODY-INVALID-INT: :[[#@LINE+1]]:40: expected unsigned integer DBG_VALUE 0, 0, !10, !DIExpression(BODY_EXPR), debug-location !12 ...