1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Generated from the source file pr19307.cc: 4*9880d681SAndroid Build Coastguard Worker; #include <string> 5*9880d681SAndroid Build Coastguard Worker; void parse_range(unsigned long long &offset, unsigned long long &limit, 6*9880d681SAndroid Build Coastguard Worker; std::string range) { 7*9880d681SAndroid Build Coastguard Worker; if (range.compare(0, 6, "items=") != 0 || range[6] == '-') 8*9880d681SAndroid Build Coastguard Worker; offset = 1; 9*9880d681SAndroid Build Coastguard Worker; range.erase(0, 6); 10*9880d681SAndroid Build Coastguard Worker; limit = 2; 11*9880d681SAndroid Build Coastguard Worker; } 12*9880d681SAndroid Build Coastguard Worker; with "clang++ -S -emit-llvm -O0 -g pr19307.cc" 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker; Location of "range" string is spilled from %rdx to stack and is 15*9880d681SAndroid Build Coastguard Worker; addressed via %rbp. 16*9880d681SAndroid Build Coastguard Worker; CHECK: movq %rdx, {{[-0-9]+}}(%rbp) 17*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[START_LABEL:.Ltmp[0-9]+]]: 18*9880d681SAndroid Build Coastguard Worker; This location should be valid until the end of the function. 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; Verify that we have proper range in debug_loc section: 21*9880d681SAndroid Build Coastguard Worker; CHECK: .Ldebug_loc{{[0-9]+}}: 22*9880d681SAndroid Build Coastguard Worker; CHECK: DW_OP_breg1 23*9880d681SAndroid Build Coastguard Worker; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0 24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .quad .Lfunc_end0-.Lfunc_begin0 25*9880d681SAndroid Build Coastguard Worker; CHECK: DW_OP_breg6 26*9880d681SAndroid Build Coastguard Worker; CHECK: DW_OP_deref 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker; ModuleID = 'pr19307.cc' 29*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 30*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu" 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker%"class.std::basic_string" = type { %"struct.std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" } 33*9880d681SAndroid Build Coastguard Worker%"struct.std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" = type { i8* } 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker@.str = private unnamed_addr constant [7 x i8] c"items=\00", align 1 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable 38*9880d681SAndroid Build Coastguard Workerdefine void @_Z11parse_rangeRyS_Ss(i64* %offset, i64* %limit, %"class.std::basic_string"* %range) #0 !dbg !13 { 39*9880d681SAndroid Build Coastguard Workerentry: 40*9880d681SAndroid Build Coastguard Worker %offset.addr = alloca i64*, align 8 41*9880d681SAndroid Build Coastguard Worker %limit.addr = alloca i64*, align 8 42*9880d681SAndroid Build Coastguard Worker store i64* %offset, i64** %offset.addr, align 8 43*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i64** %offset.addr, metadata !45, metadata !DIExpression()), !dbg !46 44*9880d681SAndroid Build Coastguard Worker store i64* %limit, i64** %limit.addr, align 8 45*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i64** %limit.addr, metadata !47, metadata !DIExpression()), !dbg !46 46*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %"class.std::basic_string"* %range, metadata !48, metadata !DIExpression(DW_OP_deref)), !dbg !49 47*9880d681SAndroid Build Coastguard Worker %call = call i32 @_ZNKSs7compareEmmPKc(%"class.std::basic_string"* %range, i64 0, i64 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0)), !dbg !50 48*9880d681SAndroid Build Coastguard Worker %cmp = icmp ne i32 %call, 0, !dbg !50 49*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %if.then, label %lor.lhs.false, !dbg !50 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Workerlor.lhs.false: ; preds = %entry 52*9880d681SAndroid Build Coastguard Worker %call1 = call i8* @_ZNSsixEm(%"class.std::basic_string"* %range, i64 6), !dbg !52 53*9880d681SAndroid Build Coastguard Worker %0 = load i8, i8* %call1, !dbg !52 54*9880d681SAndroid Build Coastguard Worker %conv = sext i8 %0 to i32, !dbg !52 55*9880d681SAndroid Build Coastguard Worker %cmp2 = icmp eq i32 %conv, 45, !dbg !52 56*9880d681SAndroid Build Coastguard Worker br i1 %cmp2, label %if.then, label %if.end, !dbg !52 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Workerif.then: ; preds = %lor.lhs.false, %entry 59*9880d681SAndroid Build Coastguard Worker %1 = load i64*, i64** %offset.addr, align 8, !dbg !54 60*9880d681SAndroid Build Coastguard Worker store i64 1, i64* %1, align 8, !dbg !54 61*9880d681SAndroid Build Coastguard Worker br label %if.end, !dbg !54 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Workerif.end: ; preds = %if.then, %lor.lhs.false 64*9880d681SAndroid Build Coastguard Worker %call3 = call %"class.std::basic_string"* @_ZNSs5eraseEmm(%"class.std::basic_string"* %range, i64 0, i64 6), !dbg !55 65*9880d681SAndroid Build Coastguard Worker %2 = load i64*, i64** %limit.addr, align 8, !dbg !56 66*9880d681SAndroid Build Coastguard Worker store i64 2, i64* %2, align 8, !dbg !56 67*9880d681SAndroid Build Coastguard Worker ret void, !dbg !57 68*9880d681SAndroid Build Coastguard Worker} 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 71*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Workerdeclare i32 @_ZNKSs7compareEmmPKc(%"class.std::basic_string"*, i64, i64, i8*) #2 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Workerdeclare i8* @_ZNSsixEm(%"class.std::basic_string"*, i64) #2 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Workerdeclare %"class.std::basic_string"* @_ZNSs5eraseEmm(%"class.std::basic_string"*, i64, i64) #2 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Workerattributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 80*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 81*9880d681SAndroid Build Coastguard Workerattributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 82*9880d681SAndroid Build Coastguard Worker 83*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 84*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!42, !43} 85*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!44} 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (209308)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !21) 88*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "pr19307.cc", directory: "/llvm_cmake_gcc") 89*9880d681SAndroid Build Coastguard Worker!2 = !{} 90*9880d681SAndroid Build Coastguard Worker!3 = !{!4, !6, !8} 91*9880d681SAndroid Build Coastguard Worker!4 = !DICompositeType(tag: DW_TAG_structure_type, line: 83, flags: DIFlagFwdDecl, file: !5, identifier: "_ZTS11__mbstate_t") 92*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "/usr/include/wchar.h", directory: "/llvm_cmake_gcc") 93*9880d681SAndroid Build Coastguard Worker!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "lconv", line: 54, flags: DIFlagFwdDecl, file: !7, identifier: "_ZTS5lconv") 94*9880d681SAndroid Build Coastguard Worker!7 = !DIFile(filename: "/usr/include/locale.h", directory: "/llvm_cmake_gcc") 95*9880d681SAndroid Build Coastguard Worker!8 = !DICompositeType(tag: DW_TAG_class_type, name: "basic_string<char, std::char_traits<char>, std::allocator<char> >", line: 1134, flags: DIFlagFwdDecl, file: !9, scope: !10, identifier: "_ZTSSs") 96*9880d681SAndroid Build Coastguard Worker!9 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.tcc", directory: "/llvm_cmake_gcc") 97*9880d681SAndroid Build Coastguard Worker!10 = !DINamespace(name: "std", line: 153, file: !11, scope: null) 98*9880d681SAndroid Build Coastguard Worker!11 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu/bits/c++config.h", directory: "/llvm_cmake_gcc") 99*9880d681SAndroid Build Coastguard Worker!13 = distinct !DISubprogram(name: "parse_range", linkageName: "_Z11parse_rangeRyS_Ss", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !1, scope: !14, type: !15, variables: !2) 100*9880d681SAndroid Build Coastguard Worker!14 = !DIFile(filename: "pr19307.cc", directory: "/llvm_cmake_gcc") 101*9880d681SAndroid Build Coastguard Worker!15 = !DISubroutineType(types: !16) 102*9880d681SAndroid Build Coastguard Worker!16 = !{null, !17, !17, !19} 103*9880d681SAndroid Build Coastguard Worker!17 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !18) 104*9880d681SAndroid Build Coastguard Worker!18 = !DIBasicType(tag: DW_TAG_base_type, name: "long long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned) 105*9880d681SAndroid Build Coastguard Worker!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "string", line: 65, file: !20, scope: !10, baseType: !8) 106*9880d681SAndroid Build Coastguard Worker!20 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/stringfwd.h", directory: "/llvm_cmake_gcc") 107*9880d681SAndroid Build Coastguard Worker!21 = !{!22, !26, !29, !33, !38, !41} 108*9880d681SAndroid Build Coastguard Worker!22 = !DIImportedEntity(tag: DW_TAG_imported_module, line: 57, scope: !23, entity: !25) 109*9880d681SAndroid Build Coastguard Worker!23 = !DINamespace(name: "__gnu_debug", line: 55, file: !24, scope: null) 110*9880d681SAndroid Build Coastguard Worker!24 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/debug/debug.h", directory: "/llvm_cmake_gcc") 111*9880d681SAndroid Build Coastguard Worker!25 = !DINamespace(name: "__debug", line: 49, file: !24, scope: !10) 112*9880d681SAndroid Build Coastguard Worker!26 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 66, scope: !10, entity: !27) 113*9880d681SAndroid Build Coastguard Worker!27 = !DIDerivedType(tag: DW_TAG_typedef, name: "mbstate_t", line: 106, file: !5, baseType: !28) 114*9880d681SAndroid Build Coastguard Worker!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "__mbstate_t", line: 95, file: !5, baseType: !4) 115*9880d681SAndroid Build Coastguard Worker!29 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 141, scope: !10, entity: !30) 116*9880d681SAndroid Build Coastguard Worker!30 = !DIDerivedType(tag: DW_TAG_typedef, name: "wint_t", line: 141, file: !31, baseType: !32) 117*9880d681SAndroid Build Coastguard Worker!31 = !DIFile(filename: "/llvm_cmake_gcc/bin/../lib/clang/3.5.0/include/stddef.h", directory: "/llvm_cmake_gcc") 118*9880d681SAndroid Build Coastguard Worker!32 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned) 119*9880d681SAndroid Build Coastguard Worker!33 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 42, scope: !34, entity: !36) 120*9880d681SAndroid Build Coastguard Worker!34 = !DINamespace(name: "__gnu_cxx", line: 69, file: !35, scope: null) 121*9880d681SAndroid Build Coastguard Worker!35 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/cpp_type_traits.h", directory: "/llvm_cmake_gcc") 122*9880d681SAndroid Build Coastguard Worker!36 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", line: 155, file: !11, scope: !10, baseType: !37) 123*9880d681SAndroid Build Coastguard Worker!37 = !DIBasicType(tag: DW_TAG_base_type, name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned) 124*9880d681SAndroid Build Coastguard Worker!38 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 43, scope: !34, entity: !39) 125*9880d681SAndroid Build Coastguard Worker!39 = !DIDerivedType(tag: DW_TAG_typedef, name: "ptrdiff_t", line: 156, file: !11, scope: !10, baseType: !40) 126*9880d681SAndroid Build Coastguard Worker!40 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed) 127*9880d681SAndroid Build Coastguard Worker!41 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 55, scope: !10, entity: !6) 128*9880d681SAndroid Build Coastguard Worker!42 = !{i32 2, !"Dwarf Version", i32 4} 129*9880d681SAndroid Build Coastguard Worker!43 = !{i32 2, !"Debug Info Version", i32 3} 130*9880d681SAndroid Build Coastguard Worker!44 = !{!"clang version 3.5.0 (209308)"} 131*9880d681SAndroid Build Coastguard Worker!45 = !DILocalVariable(name: "offset", line: 3, arg: 1, scope: !13, file: !14, type: !17) 132*9880d681SAndroid Build Coastguard Worker!46 = !DILocation(line: 3, scope: !13) 133*9880d681SAndroid Build Coastguard Worker!47 = !DILocalVariable(name: "limit", line: 3, arg: 2, scope: !13, file: !14, type: !17) 134*9880d681SAndroid Build Coastguard Worker!48 = !DILocalVariable(name: "range", line: 4, arg: 3, scope: !13, file: !14, type: !19) 135*9880d681SAndroid Build Coastguard Worker!49 = !DILocation(line: 4, scope: !13) 136*9880d681SAndroid Build Coastguard Worker!50 = !DILocation(line: 5, scope: !51) 137*9880d681SAndroid Build Coastguard Worker!51 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !13) 138*9880d681SAndroid Build Coastguard Worker!52 = !DILocation(line: 5, scope: !53) 139*9880d681SAndroid Build Coastguard Worker!53 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !51) 140*9880d681SAndroid Build Coastguard Worker!54 = !DILocation(line: 6, scope: !51) 141*9880d681SAndroid Build Coastguard Worker!55 = !DILocation(line: 7, scope: !13) 142*9880d681SAndroid Build Coastguard Worker!56 = !DILocation(line: 8, scope: !13) 143*9880d681SAndroid Build Coastguard Worker!57 = !DILocation(line: 9, scope: !13) 144*9880d681SAndroid Build Coastguard Worker 145