Bill Wendling | c02a0aa | 2013-07-22 20:15:21 +0000 | [diff] [blame] | 1 | ; RUN: llc -filetype=obj -O0 < %s |
Adrian Prantl | 5a4c862 | 2013-07-10 20:43:29 +0000 | [diff] [blame] | 2 | ; Test that we handle DBG_VALUEs in a register without crashing. |
Adrian Prantl | ef99752 | 2013-07-10 21:08:02 +0000 | [diff] [blame] | 3 | ; |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 4 | ; Generated from clang with -fsanitize=address: |
| 5 | ; struct A { |
| 6 | ; A(); |
| 7 | ; A(const A&); |
Adrian Prantl | ef99752 | 2013-07-10 21:08:02 +0000 | [diff] [blame] | 8 | ; }; |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 9 | ; |
| 10 | ; A func(int) { |
| 11 | ; A a; |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 12 | ; return a; |
Adrian Prantl | ef99752 | 2013-07-10 21:08:02 +0000 | [diff] [blame] | 13 | ; } |
| 14 | |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 15 | target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 16 | target triple = "x86_64-unknown-linux-gnu" |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 17 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 18 | %struct.A = type { i8 } |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 19 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 20 | @__asan_mapping_offset = linkonce_odr constant i64 2147450880 |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 21 | @__asan_mapping_scale = linkonce_odr constant i64 3 |
| 22 | @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }] |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 23 | @__asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 5 .addr \00", align 1 |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 24 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 25 | ; Function Attrs: sanitize_address uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 26 | define void @_Z4funci(%struct.A* noalias sret %agg.result, i32) #0 "stack-protector-buffer-size"="1" !dbg !4 { |
Adrian Prantl | 5a4c862 | 2013-07-10 20:43:29 +0000 | [diff] [blame] | 27 | entry: |
| 28 | %MyAlloca = alloca [96 x i8], align 32 |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 29 | %1 = ptrtoint [96 x i8]* %MyAlloca to i64 |
| 30 | %2 = add i64 %1, 32 |
| 31 | %3 = inttoptr i64 %2 to i32* |
| 32 | %4 = inttoptr i64 %1 to i64* |
| 33 | store i64 1102416563, i64* %4 |
| 34 | %5 = add i64 %1, 8 |
| 35 | %6 = inttoptr i64 %5 to i64* |
| 36 | store i64 ptrtoint ([16 x i8]* @__asan_gen_ to i64), i64* %6 |
| 37 | %7 = add i64 %1, 16 |
| 38 | %8 = inttoptr i64 %7 to i64* |
| 39 | store i64 ptrtoint (void (%struct.A*, i32)* @_Z4funci to i64), i64* %8 |
| 40 | %9 = lshr i64 %1, 3 |
| 41 | %10 = add i64 %9, 2147450880 |
| 42 | %11 = inttoptr i64 %10 to i32* |
| 43 | store i32 -235802127, i32* %11 |
| 44 | %12 = add i64 %10, 4 |
| 45 | %13 = inttoptr i64 %12 to i32* |
| 46 | store i32 -185273340, i32* %13 |
| 47 | %14 = add i64 %10, 8 |
| 48 | %15 = inttoptr i64 %14 to i32* |
| 49 | store i32 -202116109, i32* %15 |
| 50 | %16 = ptrtoint i32* %3 to i64 |
| 51 | %17 = lshr i64 %16, 3 |
| 52 | %18 = add i64 %17, 2147450880 |
| 53 | %19 = inttoptr i64 %18 to i8* |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 54 | %20 = load i8, i8* %19 |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 55 | %21 = icmp ne i8 %20, 0 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 56 | call void @llvm.dbg.declare(metadata i32* %3, metadata !23, metadata !28), !dbg !DILocation(scope: !4) |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 57 | br i1 %21, label %22, label %28 |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 58 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 59 | ; <label>:22 ; preds = %entry |
| 60 | %23 = and i64 %16, 7 |
| 61 | %24 = add i64 %23, 3 |
| 62 | %25 = trunc i64 %24 to i8 |
| 63 | %26 = icmp sge i8 %25, %20 |
| 64 | br i1 %26, label %27, label %28 |
| 65 | |
| 66 | ; <label>:27 ; preds = %22 |
| 67 | call void @__asan_report_store4(i64 %16) |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 68 | call void asm sideeffect "", ""() |
Adrian Prantl | 5a4c862 | 2013-07-10 20:43:29 +0000 | [diff] [blame] | 69 | unreachable |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 70 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 71 | ; <label>:28 ; preds = %22, %entry |
| 72 | store i32 %0, i32* %3, align 4 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 73 | call void @llvm.dbg.declare(metadata %struct.A* %agg.result, metadata !24, metadata !DIExpression(DW_OP_deref)), !dbg !25 |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 74 | call void @_ZN1AC1Ev(%struct.A* %agg.result), !dbg !25 |
| 75 | store i64 1172321806, i64* %4, !dbg !26 |
| 76 | %29 = inttoptr i64 %10 to i32*, !dbg !26 |
| 77 | store i32 0, i32* %29, !dbg !26 |
| 78 | %30 = add i64 %10, 4, !dbg !26 |
| 79 | %31 = inttoptr i64 %30 to i32*, !dbg !26 |
| 80 | store i32 0, i32* %31, !dbg !26 |
| 81 | %32 = add i64 %10, 8, !dbg !26 |
| 82 | %33 = inttoptr i64 %32 to i32*, !dbg !26 |
| 83 | store i32 0, i32* %33, !dbg !26 |
| 84 | ret void, !dbg !26 |
Adrian Prantl | 5a4c862 | 2013-07-10 20:43:29 +0000 | [diff] [blame] | 85 | } |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 86 | |
| 87 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 88 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 89 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 90 | declare void @_ZN1AC1Ev(%struct.A*) #2 |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 91 | |
Bill Wendling | c02a0aa | 2013-07-22 20:15:21 +0000 | [diff] [blame] | 92 | define internal void @asan.module_ctor() "stack-protector-buffer-size"="1" { |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 93 | call void @__asan_init_v3() |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 94 | %1 = load volatile i64, i64* @__asan_mapping_offset |
| 95 | %2 = load volatile i64, i64* @__asan_mapping_scale |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 96 | ret void |
| 97 | } |
| 98 | |
| 99 | declare void @__asan_init_v3() |
| 100 | |
| 101 | declare void @__asan_report_load1(i64) |
| 102 | |
| 103 | declare void @__asan_report_load2(i64) |
| 104 | |
| 105 | declare void @__asan_report_load4(i64) |
| 106 | |
| 107 | declare void @__asan_report_load8(i64) |
| 108 | |
| 109 | declare void @__asan_report_load16(i64) |
| 110 | |
| 111 | declare void @__asan_report_store1(i64) |
| 112 | |
| 113 | declare void @__asan_report_store2(i64) |
| 114 | |
| 115 | declare void @__asan_report_store4(i64) |
| 116 | |
| 117 | declare void @__asan_report_store8(i64) |
| 118 | |
| 119 | declare void @__asan_report_store16(i64) |
| 120 | |
| 121 | declare void @__asan_report_load_n(i64, i64) |
| 122 | |
| 123 | declare void @__asan_report_store_n(i64, i64) |
| 124 | |
| 125 | declare void @__asan_handle_no_return() |
| 126 | |
| 127 | declare i64 @__asan_stack_malloc(i64, i64) |
| 128 | |
| 129 | declare void @__asan_stack_free(i64, i64, i64) |
| 130 | |
| 131 | declare void @__asan_poison_stack_memory(i64, i64) |
| 132 | |
| 133 | declare void @__asan_unpoison_stack_memory(i64, i64) |
| 134 | |
| 135 | declare void @__asan_before_dynamic_init(i64) |
| 136 | |
| 137 | declare void @__asan_after_dynamic_init() |
| 138 | |
| 139 | declare void @__asan_register_globals(i64, i64) |
| 140 | |
| 141 | declare void @__asan_unregister_globals(i64, i64) |
| 142 | |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 143 | attributes #0 = { sanitize_address uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "ssp-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 144 | attributes #1 = { nounwind readnone } |
David Blaikie | 02559eb | 2013-07-15 22:28:45 +0000 | [diff] [blame] | 145 | attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "ssp-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 146 | |
Adrian Prantl | 5a4c862 | 2013-07-10 20:43:29 +0000 | [diff] [blame] | 147 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 148 | !llvm.module.flags = !{!22, !27} |
Adrian Prantl | 29b3fdc | 2013-07-11 21:16:14 +0000 | [diff] [blame] | 149 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 150 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 151 | !1 = !DIFile(filename: "crash.cpp", directory: "/tmp") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 152 | !2 = !{} |
| 153 | !3 = !{!4} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 154 | !4 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !1, scope: !5, type: !6, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 155 | !5 = !DIFile(filename: "crash.cpp", directory: "/tmp") |
| 156 | !6 = !DISubroutineType(types: !7) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 157 | !7 = !{!8, !21} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 158 | !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 8, align: 8, file: !1, elements: !9) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 159 | !9 = !{!10, !15} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 160 | !10 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !8, type: !11) |
| 161 | !11 = !DISubroutineType(types: !12) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 162 | !12 = !{null, !13} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 163 | !13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) |
| 164 | !15 = !DISubprogram(name: "A", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !8, type: !16) |
| 165 | !16 = !DISubroutineType(types: !17) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 166 | !17 = !{null, !13, !18} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 167 | !18 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !19) |
| 168 | !19 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8) |
| 169 | !21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 170 | !22 = !{i32 2, !"Dwarf Version", i32 3} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 171 | !23 = !DILocalVariable(name: "", line: 6, arg: 1, scope: !4, file: !5, type: !21) |
| 172 | !24 = !DILocalVariable(name: "a", line: 7, scope: !4, file: !5, type: !8) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 173 | !25 = !DILocation(line: 7, scope: !4) |
| 174 | !26 = !DILocation(line: 8, scope: !4) |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 175 | !27 = !{i32 1, !"Debug Info Version", i32 3} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 176 | !28 = !DIExpression(DW_OP_deref) |