brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · e674ca1 Raw
83 lines · plain
1; RUN: opt -passes=mem2reg,instcombine %s -o - -S | FileCheck %s2;3; Test that a dbg.declare describing am alloca with volatile4; load/stores is not lowered into a dbg.value, since the alloca won't5; be elided anyway.6;7; Generated from:8;9; unsigned long long g();10; void h(unsigned long long);11; void f() {12;   volatile unsigned long long v = g();13;   if (v == 0)14;     g();15;   h(v);16; }17 18; CHECK: alloca i6419; CHECK-NOT: #dbg_value20; CHECK: #dbg_declare21; CHECK-NOT: #dbg_value22 23source_filename = "volatile.c"24 25; Function Attrs: nounwind optsize ssp uwtable26define void @f() local_unnamed_addr #0 !dbg !8 {27  %1 = alloca i64, align 828  call void @llvm.lifetime.start.p0(i64 8, ptr %1), !dbg !1529  call void @llvm.dbg.declare(metadata ptr %1, metadata !12, metadata !DIExpression()), !dbg !1530  %2 = call i64 (...) @g() #4, !dbg !1531  store volatile i64 %2, ptr %1, align 8, !dbg !1532  %3 = load volatile i64, ptr %1, align 8, !dbg !1533  %4 = icmp eq i64 %3, 0, !dbg !1534  br i1 %4, label %5, label %7, !dbg !1535 36; <label>:6:                                      ; preds = %037  %6 = call i64 (...) @g() #4, !dbg !1538  br label %7, !dbg !1539 40; <label>:8:                                      ; preds = %5, %041  %8 = load volatile i64, ptr %1, align 8, !dbg !1542  call void @h(i64 %8) #4, !dbg !1543  call void @llvm.lifetime.end.p0(i64 8, ptr %1), !dbg !1544  ret void, !dbg !1545}46 47; Function Attrs: argmemonly nounwind48declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #149 50; Function Attrs: nounwind readnone speculatable51declare void @llvm.dbg.declare(metadata, metadata, metadata) #252 53; Function Attrs: optsize54declare i64 @g(...) local_unnamed_addr #355 56; Function Attrs: optsize57declare void @h(i64) local_unnamed_addr #358 59; Function Attrs: argmemonly nounwind60declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #161 62attributes #0 = { nounwind optsize ssp uwtable }63attributes #1 = { argmemonly nounwind }64attributes #2 = { nounwind readnone speculatable }65attributes #3 = { optsize }66attributes #4 = { optsize }67 68!llvm.dbg.cu = !{!0}69!llvm.module.flags = !{!3, !4}70 71!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)72!1 = !DIFile(filename: "volatile.c", directory: "/")73!3 = !{i32 2, !"Dwarf Version", i32 4}74!4 = !{i32 2, !"Debug Info Version", i32 3}75!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)76!9 = !DISubroutineType(types: !10)77!10 = !{null}78!11 = !{!12}79!12 = !DILocalVariable(name: "v", scope: !8, file: !1, line: 4, type: !13)80!13 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !14)81!14 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)82!15 = !DILocation(line: 4, column: 3, scope: !8)83