xref: /llvm-project/llvm/test/DebugInfo/debugify-bogus-dbg-value.ll (revision 1c6b0f779f66494cb597884c1a52e377bde4bc54)
1; RUN: opt -passes=check-debugify < %s 2>&1 | FileCheck %s
2; RUN: opt --experimental-debuginfo-iterators=false -passes=check-debugify < %s 2>&1 | FileCheck %s
3
4define <2 x i64> @test-fun(<2 x i64> %A) !dbg !6 {
5  %and = and <2 x i64> %A, <i64 23, i64 42>, !dbg !14
6
7; CHECK: ERROR: dbg.value operand has size 128, but its variable has size 256
8  call void @llvm.dbg.value(metadata <2 x i64> %and, metadata !12, metadata !DIExpression()), !dbg !15
9
10; CHECK: ERROR: dbg.value operand has size 512, but its variable has size 256
11  call void @llvm.dbg.value(metadata <2 x i256> zeroinitializer, metadata !12, metadata !DIExpression()), !dbg !15
12
13; CHECK: ERROR: dbg.value operand has size 8, but its variable has size 256
14  call void @llvm.dbg.value(metadata i8 0, metadata !12, metadata !DIExpression()), !dbg !15
15
16; Assume the debugger implicitly uses the lower 256 bits.
17; CHECK-NOT: ERROR: dbg.value operand has size 512, but its variable has size 256
18  call void @llvm.dbg.value(metadata i512 0, metadata !12, metadata !DIExpression()), !dbg !15
19
20; Assume the debugger implicitly zero-extends unsigned values.
21; CHECK-NOT: ERROR: dbg.value operand has size 4, but its variable has size 32
22  call void @llvm.dbg.value(metadata i8 0, metadata !17, metadata !DIExpression()), !dbg !15
23
24  ret <2 x i64> %and, !dbg !16
25}
26; CHECK: CheckModuleDebugify: FAIL
27
28; Function Attrs: nounwind readnone speculatable
29declare void @llvm.dbg.value(metadata, metadata, metadata) #0
30
31attributes #0 = { nounwind readnone speculatable }
32
33!llvm.dbg.cu = !{!0}
34!llvm.debugify = !{!3, !4}
35!llvm.module.flags = !{!5}
36
37!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
38!1 = !DIFile(filename: "/Users/vsk/src/llvm.org-main/llvm/test/DebugInfo/debugify-bogus-dbg-value.ll", directory: "/")
39!2 = !{}
40!3 = !{i32 4}
41!4 = !{i32 4}
42!5 = !{i32 2, !"Debug Info Version", i32 3}
43!6 = distinct !DISubprogram(name: "test-fun", linkageName: "test-fun", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8)
44!7 = !DISubroutineType(types: !2)
45!8 = !{!9, !11, !12}
46!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
47!10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_signed)
48!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 2, type: !10)
49!12 = !DILocalVariable(name: "3", scope: !6, file: !1, line: 3, type: !13)
50
51; Set the size here to an incorrect value to check that the size diagnostic
52; triggers.
53!13 = !DIBasicType(name: "ty128", size: 256, encoding: DW_ATE_signed)
54
55!14 = !DILocation(line: 2, column: 1, scope: !6)
56!15 = !DILocation(line: 3, column: 1, scope: !6)
57!16 = !DILocation(line: 4, column: 1, scope: !6)
58
59!17 = !DILocalVariable(name: "4", scope: !6, file: !1, line: 3, type: !18)
60!18 = !DIBasicType(name: "ty32_unsigned", size: 32, encoding: DW_ATE_unsigned)
61