1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s 2; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s 3; RUN: llc < %s | FileCheck %s --check-prefix=ASM 4 5; Repeat with experimental debuginfo iterators. 6; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s 7; RUN: llc --try-experimental-debuginfo-iterators < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s 8; RUN: llc --try-experimental-debuginfo-iterators < %s | FileCheck %s --check-prefix=ASM 9 10; C++ source to regenerate: 11; $ cat numeric-leaves.cpp 12; const long long Minus1 = -1; 13; const long long Minus128 = -128; 14; const long long Minus129 = -129; 15; const long long Minus32768 = -32768; 16; const long long Minus32769 = -32769; 17; const long long Minus2147483648 = -2147483648; 18; const long long Minus2147483649 = -2147483649; 19; 20; const long long Zero = 0; 21; const long long Plus32767 = 32767; 22; const long long Plus32768 = 32768; 23; const long long Plus2147483647 = 2147483647; 24; const long long Plus2147483648 = 2147483648; 25; 26; int main(){ 27; long long iDebug1 = Minus1 + Minus128 + Minus129 + 28; Minus32768 + Minus32769 + 29; Minus2147483648 + Minus2147483649; 30; long long iDebug2 = Zero + Plus32767 + Plus32768 + 31; Plus2147483647 + Plus2147483648; 32; 33; return 0; 34;} 35; 36; $ clang numeric-leaves.cpp -S -emit-llvm -g -gcodeview -o nl.ll 37 38; CHECK: ConstantSym { 39; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 40; CHECK-NEXT: Type: const __int64 (0x1003) 41; CHECK-NEXT: Value: -1 42; CHECK-NEXT: Name: Minus1 43; CHECK-NEXT: } 44; CHECK: ConstantSym { 45; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 46; CHECK-NEXT: Type: const __int64 (0x1003) 47; CHECK-NEXT: Value: -128 48; CHECK-NEXT: Name: Minus128 49; CHECK-NEXT: } 50; CHECK: ConstantSym { 51; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 52; CHECK-NEXT: Type: const __int64 (0x1003) 53; CHECK-NEXT: Value: -129 54; CHECK-NEXT: Name: Minus129 55; CHECK-NEXT: } 56; CHECK: ConstantSym { 57; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 58; CHECK-NEXT: Type: const __int64 (0x1003) 59; CHECK-NEXT: Value: -32768 60; CHECK-NEXT: Name: Minus32768 61; CHECK-NEXT: } 62; CHECK: ConstantSym { 63; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 64; CHECK-NEXT: Type: const __int64 (0x1003) 65; CHECK-NEXT: Value: -32769 66; CHECK-NEXT: Name: Minus32769 67; CHECK-NEXT: } 68; CHECK: ConstantSym { 69; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 70; CHECK-NEXT: Type: const __int64 (0x1003) 71; CHECK-NEXT: Value: -2147483648 72; CHECK-NEXT: Name: Minus2147483648 73; CHECK-NEXT: } 74; CHECK: ConstantSym { 75; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 76; CHECK-NEXT: Type: const __int64 (0x1003) 77; CHECK-NEXT: Value: -2147483649 78; CHECK-NEXT: Name: Minus2147483649 79; CHECK-NEXT: } 80; CHECK: ConstantSym { 81; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 82; CHECK-NEXT: Type: const __int64 (0x1003) 83; CHECK-NEXT: Value: 0 84; CHECK-NEXT: Name: Zero 85; CHECK-NEXT: } 86; CHECK: ConstantSym { 87; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 88; CHECK-NEXT: Type: const __int64 (0x1003) 89; CHECK-NEXT: Value: 32767 90; CHECK-NEXT: Name: Plus32767 91; CHECK-NEXT: } 92; CHECK: ConstantSym { 93; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 94; CHECK-NEXT: Type: const __int64 (0x1003) 95; CHECK-NEXT: Value: 32768 96; CHECK-NEXT: Name: Plus32768 97; CHECK-NEXT: } 98; CHECK: ConstantSym { 99; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 100; CHECK-NEXT: Type: const __int64 (0x1003) 101; CHECK-NEXT: Value: 2147483647 102; CHECK-NEXT: Name: Plus2147483647 103; CHECK-NEXT: } 104; CHECK: ConstantSym { 105; CHECK-NEXT: Kind: S_CONSTANT (0x1107) 106; CHECK-NEXT: Type: const __int64 (0x1003) 107; CHECK-NEXT: Value: 2147483648 108; CHECK-NEXT: Name: Plus2147483648 109 110; ASM-LABEL: long 241 # Symbol subsection for globals 111 112; ASM: .short 4359 # Record kind: S_CONSTANT 113; ASM-NEXT: .long 4099 # Type 114; ASM-NEXT: .byte 0x00, 0x80, 0xff # Value 115; ASM-NEXT: .asciz "Minus1" # Name 116 117; ASM: .short 4359 # Record kind: S_CONSTANT 118; ASM-NEXT: .long 4099 # Type 119; ASM-NEXT: .byte 0x00, 0x80, 0x80 # Value 120; ASM-NEXT: .asciz "Minus128" # Name 121 122; ASM: .short 4359 # Record kind: S_CONSTANT 123; ASM-NEXT: .long 4099 # Type 124; ASM-NEXT: .byte 0x01, 0x80, 0x7f, 0xff # Value 125; ASM-NEXT: .asciz "Minus129" # Name 126 127; ASM: .short 4359 # Record kind: S_CONSTANT 128; ASM-NEXT: .long 4099 # Type 129; ASM-NEXT: .byte 0x01, 0x80, 0x00, 0x80 # Value 130; ASM-NEXT: .asciz "Minus32768" # Name 131 132; ASM: .short 4359 # Record kind: S_CONSTANT 133; ASM-NEXT: .long 4099 # Type 134; ASM-NEXT: .byte 0x03, 0x80, 0xff, 0x7f # Value 135; ASM-NEXT: .byte 0xff, 0xff 136; ASM-NEXT: .asciz "Minus32769" # Name 137 138; ASM: .short 4359 # Record kind: S_CONSTANT 139; ASM-NEXT: .long 4099 # Type 140; ASM-NEXT: .byte 0x03, 0x80, 0x00, 0x00 # Value 141; ASM-NEXT: .byte 0x00, 0x80 142; ASM-NEXT: .asciz "Minus2147483648" # Name 143 144; ASM: .short 4359 # Record kind: S_CONSTANT 145; ASM-NEXT: .long 4099 # Type 146; ASM-NEXT: .byte 0x09, 0x80, 0xff, 0xff # Value 147; ASM-NEXT: .byte 0xff, 0x7f, 0xff, 0xff 148; ASM-NEXT: .byte 0xff, 0xff 149; ASM-NEXT: .asciz "Minus2147483649" # Name 150 151; ASM: .short 4359 # Record kind: S_CONSTANT 152; ASM-NEXT: .long 4099 # Type 153; ASM-NEXT: .byte 0x00, 0x00 # Value 154; ASM-NEXT: .asciz "Zero" # Name 155 156; ASM: .short 4359 # Record kind: S_CONSTANT 157; ASM-NEXT: .long 4099 # Type 158; ASM-NEXT: .byte 0xff, 0x7f # Value 159; ASM-NEXT: .asciz "Plus32767" # Name 160 161; ASM: .short 4359 # Record kind: S_CONSTANT 162; ASM-NEXT: .long 4099 # Type 163; ASM-NEXT: .byte 0x03, 0x80, 0x00, 0x80 # Value 164; ASM-NEXT: .byte 0x00, 0x00 165; ASM-NEXT: .asciz "Plus32768" # Name 166 167; ASM: .short 4359 # Record kind: S_CONSTANT 168; ASM-NEXT: .long 4099 # Type 169; ASM-NEXT: .byte 0x03, 0x80, 0xff, 0xff # Value 170; ASM-NEXT: .byte 0xff, 0x7f 171; ASM-NEXT: .asciz "Plus2147483647" # Name 172 173; ASM: .short 4359 # Record kind: S_CONSTANT 174; ASM-NEXT: .long 4099 # Type 175; ASM-NEXT: .byte 0x09, 0x80, 0x00, 0x00 # Value 176; ASM-NEXT: .byte 0x00, 0x80, 0x00, 0x00 177; ASM-NEXT: .byte 0x00, 0x00 178; ASM-NEXT: .asciz "Plus2147483648" # Name 179 180; ModuleID = 'numeric-leaves.cpp' 181source_filename = "numeric-leaves.cpp" 182target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 183target triple = "x86_64-pc-windows-msvc19.29.30133" 184 185; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable 186define dso_local noundef i32 @main() #0 !dbg !35 { 187entry: 188 %retval = alloca i32, align 4 189 %iDebug1 = alloca i64, align 8 190 %iDebug2 = alloca i64, align 8 191 store i32 0, ptr %retval, align 4 192 call void @llvm.dbg.declare(metadata ptr %iDebug1, metadata !40, metadata !DIExpression()), !dbg !41 193 store i64 -4295033092, ptr %iDebug1, align 8, !dbg !41 194 call void @llvm.dbg.declare(metadata ptr %iDebug2, metadata !42, metadata !DIExpression()), !dbg !43 195 store i64 4295032830, ptr %iDebug2, align 8, !dbg !43 196 ret i32 0, !dbg !44 197} 198 199; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 200declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 201 202attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 203attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } 204 205!llvm.dbg.cu = !{!0} 206!llvm.module.flags = !{!29, !30, !31, !32, !33} 207!llvm.ident = !{!34} 208 209!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !2, splitDebugInlining: false, nameTableKind: None) 210!1 = !DIFile(filename: "numeric-leaves.cpp", directory: "d:\\tmp", checksumkind: CSK_MD5, checksum: "9b1d86040d3b979a9b2b3e86c7bea0b4") 211!2 = !{!3, !7, !9, !11, !13, !15, !17, !19, !21, !23, !25, !27} 212!3 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression(DW_OP_constu, 18446744073709551615, DW_OP_stack_value)) 213!4 = distinct !DIGlobalVariable(name: "Minus1", scope: !0, file: !1, line: 1, type: !5, isLocal: true, isDefinition: true) 214!5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) 215!6 = !DIBasicType(name: "long long", size: 64, encoding: DW_ATE_signed) 216!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_constu, 18446744073709551488, DW_OP_stack_value)) 217!8 = distinct !DIGlobalVariable(name: "Minus128", scope: !0, file: !1, line: 2, type: !5, isLocal: true, isDefinition: true) 218!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression(DW_OP_constu, 18446744073709551487, DW_OP_stack_value)) 219!10 = distinct !DIGlobalVariable(name: "Minus129", scope: !0, file: !1, line: 3, type: !5, isLocal: true, isDefinition: true) 220!11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression(DW_OP_constu, 18446744073709518848, DW_OP_stack_value)) 221!12 = distinct !DIGlobalVariable(name: "Minus32768", scope: !0, file: !1, line: 4, type: !5, isLocal: true, isDefinition: true) 222!13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression(DW_OP_constu, 18446744073709518847, DW_OP_stack_value)) 223!14 = distinct !DIGlobalVariable(name: "Minus32769", scope: !0, file: !1, line: 5, type: !5, isLocal: true, isDefinition: true) 224!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression(DW_OP_constu, 18446744071562067968, DW_OP_stack_value)) 225!16 = distinct !DIGlobalVariable(name: "Minus2147483648", scope: !0, file: !1, line: 6, type: !5, isLocal: true, isDefinition: true) 226!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression(DW_OP_constu, 18446744071562067967, DW_OP_stack_value)) 227!18 = distinct !DIGlobalVariable(name: "Minus2147483649", scope: !0, file: !1, line: 7, type: !5, isLocal: true, isDefinition: true) 228!19 = !DIGlobalVariableExpression(var: !20, expr: !DIExpression(DW_OP_constu, 0, DW_OP_stack_value)) 229!20 = distinct !DIGlobalVariable(name: "Zero", scope: !0, file: !1, line: 9, type: !5, isLocal: true, isDefinition: true) 230!21 = !DIGlobalVariableExpression(var: !22, expr: !DIExpression(DW_OP_constu, 32767, DW_OP_stack_value)) 231!22 = distinct !DIGlobalVariable(name: "Plus32767", scope: !0, file: !1, line: 10, type: !5, isLocal: true, isDefinition: true) 232!23 = !DIGlobalVariableExpression(var: !24, expr: !DIExpression(DW_OP_constu, 32768, DW_OP_stack_value)) 233!24 = distinct !DIGlobalVariable(name: "Plus32768", scope: !0, file: !1, line: 11, type: !5, isLocal: true, isDefinition: true) 234!25 = !DIGlobalVariableExpression(var: !26, expr: !DIExpression(DW_OP_constu, 2147483647, DW_OP_stack_value)) 235!26 = distinct !DIGlobalVariable(name: "Plus2147483647", scope: !0, file: !1, line: 12, type: !5, isLocal: true, isDefinition: true) 236!27 = !DIGlobalVariableExpression(var: !28, expr: !DIExpression(DW_OP_constu, 2147483648, DW_OP_stack_value)) 237!28 = distinct !DIGlobalVariable(name: "Plus2147483648", scope: !0, file: !1, line: 13, type: !5, isLocal: true, isDefinition: true) 238!29 = !{i32 2, !"CodeView", i32 1} 239!30 = !{i32 2, !"Debug Info Version", i32 3} 240!31 = !{i32 1, !"wchar_size", i32 2} 241!32 = !{i32 7, !"PIC Level", i32 2} 242!33 = !{i32 7, !"uwtable", i32 2} 243!34 = !{!"clang version 15.0.0"} 244!35 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 15, type: !36, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !39) 245!36 = !DISubroutineType(types: !37) 246!37 = !{!38} 247!38 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 248!39 = !{} 249!40 = !DILocalVariable(name: "iDebug1", scope: !35, file: !1, line: 16, type: !6) 250!41 = !DILocation(line: 16, scope: !35) 251!42 = !DILocalVariable(name: "iDebug2", scope: !35, file: !1, line: 19, type: !6) 252!43 = !DILocation(line: 19, scope: !35) 253!44 = !DILocation(line: 22, scope: !35) 254