|
| 1 | +; Just run it through opt, no passes needed. |
| 2 | +; RUN: opt < %s -S --write-experimental-debuginfo=true | FileCheck %s |
| 3 | + |
| 4 | +; ModuleID = 'various_ir_values.c' |
| 5 | +source_filename = "various_ir_values.c" |
| 6 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 7 | +target triple = "x86_64-unknown-linux-gnu" |
| 8 | + |
| 9 | +; Function Attrs: nounwind uwtable |
| 10 | +define dso_local void @foo(ptr %A) #0 !dbg !7 { |
| 11 | +entry: |
| 12 | + %A.addr = alloca ptr, align 8, !DIAssignID !16 |
| 13 | + %i = alloca i32, align 4 |
| 14 | + #dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17) |
| 15 | + store ptr %A, ptr %A.addr, align 8, !tbaa !18 |
| 16 | + #dbg_declare(ptr %A.addr, !13, !DIExpression(), !17) |
| 17 | + call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !22 |
| 18 | + #dbg_declare(ptr %i, !14, !DIExpression(), !23) |
| 19 | + store i32 0, ptr %i, align 4, !dbg !23, !tbaa !24 |
| 20 | + br label %for.cond, !dbg !22 |
| 21 | + |
| 22 | +for.cond: ; preds = %for.inc, %entry |
| 23 | + %0 = load i32, ptr %i, align 4, !dbg !26, !tbaa !24 |
| 24 | + %1 = load ptr, ptr %A.addr, align 8, !dbg !28, !tbaa !18 |
| 25 | + %2 = load i32, ptr %1, align 4, !dbg !29, !tbaa !24 |
| 26 | + %cmp = icmp slt i32 %0, %2, !dbg !30 |
| 27 | + br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !31, !prof !32 |
| 28 | + |
| 29 | +for.cond.cleanup: ; preds = %for.cond |
| 30 | + call void @llvm.lifetime.end.p0(i64 4, ptr %i) #2, !dbg !33 |
| 31 | + br label %for.end |
| 32 | + |
| 33 | +for.body: ; preds = %for.cond |
| 34 | + %3 = load ptr, ptr %A.addr, align 8, !dbg !34, !tbaa !18 |
| 35 | + %4 = load i32, ptr %i, align 4, !dbg !35, !tbaa !24 |
| 36 | + %idxprom = sext i32 %4 to i64, !dbg !34 |
| 37 | + %arrayidx = getelementptr inbounds i32, ptr %3, i64 %idxprom, !dbg !34 |
| 38 | + store i32 0, ptr %arrayidx, align 4, !dbg !36, !tbaa !24 |
| 39 | + br label %for.inc, !dbg !34 |
| 40 | + |
| 41 | +for.inc: ; preds = %for.body |
| 42 | + %5 = load i32, ptr %i, align 4, !dbg !37, !tbaa !24 |
| 43 | + %inc = add nsw i32 %5, 1, !dbg !37 |
| 44 | + store i32 %inc, ptr %i, align 4, !dbg !37, !tbaa !24 |
| 45 | + br label %for.cond, !dbg !33, !llvm.loop !38 |
| 46 | + |
| 47 | +for.end: ; preds = %for.cond.cleanup |
| 48 | + ret void, !dbg !40 |
| 49 | +} |
| 50 | + |
| 51 | +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) |
| 52 | +declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 |
| 53 | + |
| 54 | +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) |
| 55 | +declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 |
| 56 | + |
| 57 | +; Function Attrs: nounwind uwtable |
| 58 | +define dso_local void @bar(ptr %A) #0 !dbg !41 { |
| 59 | +entry: |
| 60 | + %A.addr = alloca ptr, align 8 |
| 61 | + %i = alloca i32, align 4 |
| 62 | + store ptr %A, ptr %A.addr, align 8, !tbaa !18 |
| 63 | + #dbg_declare(ptr %A.addr, !43, !DIExpression(), !46) |
| 64 | + call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !47 |
| 65 | + #dbg_declare(ptr %i, !44, !DIExpression(), !48) |
| 66 | + store i32 0, ptr %i, align 4, !dbg !48, !tbaa !24 |
| 67 | + br label %for.cond, !dbg !47 |
| 68 | + |
| 69 | +for.cond: ; preds = %for.inc, %entry |
| 70 | + %0 = load i32, ptr %i, align 4, !dbg !49, !tbaa !24 |
| 71 | + %1 = load ptr, ptr %A.addr, align 8, !dbg !51, !tbaa !18 |
| 72 | + %2 = load i32, ptr %1, align 4, !dbg !52, !tbaa !24 |
| 73 | + %cmp = icmp slt i32 %0, %2, !dbg !53 |
| 74 | + br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !54 |
| 75 | + |
| 76 | +for.cond.cleanup: ; preds = %for.cond |
| 77 | + call void @llvm.lifetime.end.p0(i64 4, ptr %i) #2, !dbg !55 |
| 78 | + br label %for.end |
| 79 | + |
| 80 | +for.body: ; preds = %for.cond |
| 81 | + %3 = load ptr, ptr %A.addr, align 8, !dbg !56, !tbaa !18 |
| 82 | + %4 = load i32, ptr %i, align 4, !dbg !57, !tbaa !24 |
| 83 | + %idxprom = sext i32 %4 to i64, !dbg !56 |
| 84 | + %arrayidx = getelementptr inbounds i32, ptr %3, i64 %idxprom, !dbg !56 |
| 85 | + store i32 0, ptr %arrayidx, align 4, !dbg !58, !tbaa !24 |
| 86 | + br label %for.inc, !dbg !56 |
| 87 | + |
| 88 | +for.inc: ; preds = %for.body |
| 89 | + %5 = load i32, ptr %i, align 4, !dbg !59, !tbaa !24 |
| 90 | + %inc = add nsw i32 %5, 1, !dbg !59 |
| 91 | + store i32 %inc, ptr %i, align 4, !dbg !59, !tbaa !24 |
| 92 | + br label %for.cond, !dbg !55, !llvm.loop !60 |
| 93 | + |
| 94 | +for.end: ; preds = %for.cond.cleanup |
| 95 | + ret void, !dbg !62 |
| 96 | +} |
| 97 | + |
| 98 | +attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="ieee,ieee" "denormal-fp-math-f32"="ieee,ieee" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 99 | +attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } |
| 100 | +attributes #2 = { nounwind } |
| 101 | + |
| 102 | +!llvm.dbg.cu = !{!0} |
| 103 | +!llvm.module.flags = !{!3, !4, !5} |
| 104 | +!llvm.ident = !{!6} |
| 105 | + |
| 106 | +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ([email protected]:llvm/llvm-project.git 1d5da8cd30fce1c0a2c2fa6ba656dbfaa36192c8)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) |
| 107 | +!1 = !DIFile(filename: "various_ir_values.c", directory: "/data/build/llvm-project") |
| 108 | +!2 = !{} |
| 109 | +!3 = !{i32 7, !"Dwarf Version", i32 4} |
| 110 | +!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 111 | +!5 = !{i32 1, !"wchar_size", i32 4} |
| 112 | +!6 = !{! "clang version 11.0.0 ([email protected]:llvm/llvm-project.git 1d5da8cd30fce1c0a2c2fa6ba656dbfaa36192c8)"} |
| 113 | +!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12) |
| 114 | +!8 = !DISubroutineType(types: !9) |
| 115 | +!9 = !{null, !10} |
| 116 | +!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) |
| 117 | +!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 118 | +!12 = !{!13, !14} |
| 119 | +!13 = !DILocalVariable(name: "A", arg: 1, scope: !7, file: !1, line: 1, type: !10) |
| 120 | +!14 = !DILocalVariable(name: "i", scope: !15, file: !1, line: 3, type: !11) |
| 121 | +!15 = distinct !DILexicalBlock(scope: !7, file: !1, line: 3, column: 3) |
| 122 | +!16 = distinct !DIAssignID() |
| 123 | +!17 = !DILocation(line: 1, column: 15, scope: !7) |
| 124 | +!18 = !{!19, !19, i64 0} |
| 125 | +!19 = !{!"any pointer", !20, i64 0} |
| 126 | +!20 = !{!"omnipotent char", !21, i64 0} |
| 127 | +!21 = !{!"Simple C/C++ TBAA"} |
| 128 | +!22 = !DILocation(line: 3, column: 8, scope: !15) |
| 129 | +!23 = !DILocation(line: 3, column: 12, scope: !15) |
| 130 | +!24 = !{!25, !25, i64 0} |
| 131 | +!25 = !{!"int", !20, i64 0} |
| 132 | +!26 = !DILocation(line: 3, column: 19, scope: !27) |
| 133 | +!27 = distinct !DILexicalBlock(scope: !15, file: !1, line: 3, column: 3) |
| 134 | +!28 = !DILocation(line: 3, column: 24, scope: !27) |
| 135 | +!29 = !DILocation(line: 3, column: 23, scope: !27) |
| 136 | +!30 = !DILocation(line: 3, column: 21, scope: !27) |
| 137 | +!31 = !DILocation(line: 3, column: 3, scope: !15) |
| 138 | +!32 = !{!"branch_weights", i32 1, i32 1048575} |
| 139 | +!33 = !DILocation(line: 3, column: 3, scope: !27) |
| 140 | +!34 = !DILocation(line: 4, column: 5, scope: !27) |
| 141 | +!35 = !DILocation(line: 4, column: 7, scope: !27) |
| 142 | +!36 = !DILocation(line: 4, column: 10, scope: !27) |
| 143 | +!37 = !DILocation(line: 3, column: 27, scope: !27) |
| 144 | +!38 = distinct !{!38, !31, !39} |
| 145 | +!39 = !DILocation(line: 4, column: 12, scope: !15) |
| 146 | +!40 = !DILocation(line: 5, column: 1, scope: !7) |
| 147 | +!41 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 7, type: !8, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !42) |
| 148 | +!42 = !{!43, !44} |
| 149 | +!43 = !DILocalVariable(name: "A", arg: 1, scope: !41, file: !1, line: 7, type: !10) |
| 150 | +!44 = !DILocalVariable(name: "i", scope: !45, file: !1, line: 9, type: !11) |
| 151 | +!45 = distinct !DILexicalBlock(scope: !41, file: !1, line: 9, column: 3) |
| 152 | +!46 = !DILocation(line: 7, column: 15, scope: !41) |
| 153 | +!47 = !DILocation(line: 9, column: 8, scope: !45) |
| 154 | +!48 = !DILocation(line: 9, column: 12, scope: !45) |
| 155 | +!49 = !DILocation(line: 9, column: 19, scope: !50) |
| 156 | +!50 = distinct !DILexicalBlock(scope: !45, file: !1, line: 9, column: 3) |
| 157 | +!51 = !DILocation(line: 9, column: 24, scope: !50) |
| 158 | +!52 = !DILocation(line: 9, column: 23, scope: !50) |
| 159 | +!53 = !DILocation(line: 9, column: 21, scope: !50) |
| 160 | +!54 = !DILocation(line: 9, column: 3, scope: !45) |
| 161 | +!55 = !DILocation(line: 9, column: 3, scope: !50) |
| 162 | +!56 = !DILocation(line: 10, column: 5, scope: !50) |
| 163 | +!57 = !DILocation(line: 10, column: 7, scope: !50) |
| 164 | +!58 = !DILocation(line: 10, column: 10, scope: !50) |
| 165 | +!59 = !DILocation(line: 9, column: 27, scope: !50) |
| 166 | +!60 = distinct !{!60, !54, !61} |
| 167 | +!61 = !DILocation(line: 10, column: 12, scope: !45) |
| 168 | +!62 = !DILocation(line: 11, column: 1, scope: !41) |
0 commit comments