84 lines · plain
1; RUN: llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 < %s | FileCheck %s2; RUN: %if ptxas-isa-7.0 %{ llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 < %s | %ptxas-verify %}3 4; Generated with -O1 from:5; int f1();6; void f2(int*);7; int f3(int);8;9; int foo() {10; int i = 3;11; f3(i);12; i = 7;13; i = f1();14; f2(&i);15; return 0;16; }17;18; Test that we generate valid debug info for optimized code,19; particularly variables that are described as constants and passed20; by reference.21;22; CHECK: DEBUG_VALUE: foo:i <- 323; CHECK: DEBUG_VALUE: foo:i <- 724; CHECK: DEBUG_VALUE: foo:i <- %25; CHECK: DEBUG_VALUE: foo:i <- [DW_OP_deref] $vrdepot26 27; Function Attrs: nounwind ssp uwtable28define i32 @foo() #0 !dbg !4 {29entry:30 %i = alloca i32, align 431 call void @llvm.dbg.value(metadata i32 3, metadata !10, metadata !DIExpression()), !dbg !1532 %call = call i32 @f3(i32 3) #3, !dbg !1633 call void @llvm.dbg.value(metadata i32 7, metadata !10, metadata !DIExpression()), !dbg !1834 %call1 = call i32 @f1() #3, !dbg !1935 call void @llvm.dbg.value(metadata i32 %call1, metadata !10, metadata !DIExpression()), !dbg !1936 store i32 %call1, ptr %i, align 4, !dbg !19, !tbaa !2037 call void @llvm.dbg.value(metadata ptr %i, metadata !10, metadata !DIExpression(DW_OP_deref)), !dbg !2438 call void @f2(ptr %i) #3, !dbg !2439 ret i32 0, !dbg !2540}41 42declare i32 @f3(i32)43 44declare i32 @f1()45 46declare void @f2(ptr)47 48; Function Attrs: nounwind readnone49declare void @llvm.dbg.value(metadata, metadata, metadata) #250 51attributes #0 = { nounwind ssp uwtable }52attributes #2 = { nounwind readnone }53attributes #3 = { nounwind }54 55!llvm.dbg.cu = !{!0}56!llvm.module.flags = !{!11, !12}57!llvm.ident = !{!13}58 59!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2, nameTableKind: None)60!1 = !DIFile(filename: "dbg-value-const-byref.c", directory: "")61!2 = !{}62!4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !9)63!5 = !DIFile(filename: "dbg-value-const-byref.c", directory: "")64!6 = !DISubroutineType(types: !7)65!7 = !{!8}66!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)67!9 = !{!10}68!10 = !DILocalVariable(name: "i", line: 6, scope: !4, file: !5, type: !8)69!11 = !{i32 2, !"Dwarf Version", i32 2}70!12 = !{i32 1, !"Debug Info Version", i32 3}71!13 = !{!"clang version 3.5.0 "}72!14 = !{i32 3}73!15 = !DILocation(line: 6, scope: !4)74!16 = !DILocation(line: 7, scope: !4)75!17 = !{i32 7}76!18 = !DILocation(line: 8, scope: !4)77!19 = !DILocation(line: 9, scope: !4)78!20 = !{!21, !21, i64 0}79!21 = !{!"int", !22, i64 0}80!22 = !{!"omnipotent char", !23, i64 0}81!23 = !{!"Simple C/C++ TBAA"}82!24 = !DILocation(line: 10, scope: !4)83!25 = !DILocation(line: 11, scope: !4)84