1; RUN: opt -passes=mem2reg,instcombine %s -o - -S | FileCheck %s 2; RUN: opt -passes=mem2reg,instcombine %s -o - -S --try-experimental-debuginfo-iterators | FileCheck %s 3; 4; Test that a dbg.declare describing am alloca with volatile 5; load/stores is not lowered into a dbg.value, since the alloca won't 6; be elided anyway. 7; 8; Generated from: 9; 10; unsigned long long g(); 11; void h(unsigned long long); 12; void f() { 13; volatile unsigned long long v = g(); 14; if (v == 0) 15; g(); 16; h(v); 17; } 18 19; CHECK: alloca i64 20; CHECK-NOT: #dbg_value 21; CHECK: #dbg_declare 22; CHECK-NOT: #dbg_value 23 24source_filename = "volatile.c" 25 26; Function Attrs: nounwind optsize ssp uwtable 27define void @f() local_unnamed_addr #0 !dbg !8 { 28 %1 = alloca i64, align 8 29 call void @llvm.lifetime.start.p0(i64 8, ptr %1), !dbg !15 30 call void @llvm.dbg.declare(metadata ptr %1, metadata !12, metadata !DIExpression()), !dbg !15 31 %2 = call i64 (...) @g() #4, !dbg !15 32 store volatile i64 %2, ptr %1, align 8, !dbg !15 33 %3 = load volatile i64, ptr %1, align 8, !dbg !15 34 %4 = icmp eq i64 %3, 0, !dbg !15 35 br i1 %4, label %5, label %7, !dbg !15 36 37; <label>:6: ; preds = %0 38 %6 = call i64 (...) @g() #4, !dbg !15 39 br label %7, !dbg !15 40 41; <label>:8: ; preds = %5, %0 42 %8 = load volatile i64, ptr %1, align 8, !dbg !15 43 call void @h(i64 %8) #4, !dbg !15 44 call void @llvm.lifetime.end.p0(i64 8, ptr %1), !dbg !15 45 ret void, !dbg !15 46} 47 48; Function Attrs: argmemonly nounwind 49declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1 50 51; Function Attrs: nounwind readnone speculatable 52declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 53 54; Function Attrs: optsize 55declare i64 @g(...) local_unnamed_addr #3 56 57; Function Attrs: optsize 58declare void @h(i64) local_unnamed_addr #3 59 60; Function Attrs: argmemonly nounwind 61declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1 62 63attributes #0 = { nounwind optsize ssp uwtable } 64attributes #1 = { argmemonly nounwind } 65attributes #2 = { nounwind readnone speculatable } 66attributes #3 = { optsize } 67attributes #4 = { optsize } 68 69!llvm.dbg.cu = !{!0} 70!llvm.module.flags = !{!3, !4} 71 72!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) 73!1 = !DIFile(filename: "volatile.c", directory: "/") 74!3 = !{i32 2, !"Dwarf Version", i32 4} 75!4 = !{i32 2, !"Debug Info Version", i32 3} 76!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, retainedNodes: !11) 77!9 = !DISubroutineType(types: !10) 78!10 = !{null} 79!11 = !{!12} 80!12 = !DILocalVariable(name: "v", scope: !8, file: !1, line: 4, type: !13) 81!13 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !14) 82!14 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) 83!15 = !DILocation(line: 4, column: 3, scope: !8) 84