1 ; RUN: llc -filetype=obj -mtriple=x86_64-pc-linux-gnu %s -o %t 2 ; RUN: llvm-readobj --relocations %t | FileCheck %s 3 4 ; Check that we don't have any relocations in the ranges section - 5 ; to show that we're producing this as a relative offset to the 6 ; low_pc for the compile unit. 7 ; CHECK-NOT: .rela.debug_ranges 8 9 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 0, void ()* @__msan_init }] 10 @str = private unnamed_addr constant [4 x i8] c"zzz\00" 11 @__msan_retval_tls = external thread_local(initialexec) global [8 x i64] 12 @__msan_retval_origin_tls = external thread_local(initialexec) global i32 13 @__msan_param_tls = external thread_local(initialexec) global [1000 x i64] 14 @__msan_param_origin_tls = external thread_local(initialexec) global [1000 x i32] 15 @__msan_va_arg_tls = external thread_local(initialexec) global [1000 x i64] 16 @__msan_va_arg_overflow_size_tls = external thread_local(initialexec) global i64 17 @__msan_origin_tls = external thread_local(initialexec) global i32 18 @__executable_start = external hidden global i32 19 @_end = external hidden global i32 20 21 ; Function Attrs: sanitize_memory uwtable 22 define void @_Z1fv() #0 { 23 entry: 24 %p = alloca i32*, align 8 25 %0 = ptrtoint i32** %p to i64, !dbg !19 26 %1 = and i64 %0, -70368744177672, !dbg !19 27 %2 = inttoptr i64 %1 to i64*, !dbg !19 28 store i64 -1, i64* %2, align 8, !dbg !19 29 store i64 0, i64* getelementptr inbounds ([1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !19 30 store i64 0, i64* getelementptr inbounds ([8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !19 31 %call = call i8* @_Znwm(i64 4) #4, !dbg !19 32 %_msret = load i64* getelementptr inbounds ([8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !19 33 %3 = bitcast i8* %call to i32*, !dbg !19 34 tail call void @llvm.dbg.value(metadata !{i32* %3}, i64 0, metadata !9), !dbg !19 35 %4 = inttoptr i64 %1 to i64*, !dbg !19 36 store i64 %_msret, i64* %4, align 8, !dbg !19 37 store volatile i32* %3, i32** %p, align 8, !dbg !19 38 tail call void @llvm.dbg.value(metadata !{i32** %p}, i64 0, metadata !9), !dbg !19 39 %p.0.p.0. = load volatile i32** %p, align 8, !dbg !20 40 %_msld = load i64* %4, align 8, !dbg !20 41 %_mscmp = icmp eq i64 %_msld, 0, !dbg !20 42 br i1 %_mscmp, label %6, label %5, !dbg !20, !prof !22 43 44 ; <label>:5 ; preds = %entry 45 call void @__msan_warning_noreturn(), !dbg !20 46 call void asm sideeffect "", ""() #3, !dbg !20 47 unreachable, !dbg !20 48 49 ; <label>:6 ; preds = %entry 50 %7 = load i32* %p.0.p.0., align 4, !dbg !20, !tbaa !23 51 %8 = ptrtoint i32* %p.0.p.0. to i64, !dbg !20 52 %9 = and i64 %8, -70368744177665, !dbg !20 53 %10 = inttoptr i64 %9 to i32*, !dbg !20 54 %_msld2 = load i32* %10, align 4, !dbg !20 55 %11 = icmp ne i32 %_msld2, 0, !dbg !20 56 %12 = xor i32 %_msld2, -1, !dbg !20 57 %13 = and i32 %7, %12, !dbg !20 58 %14 = icmp eq i32 %13, 0, !dbg !20 59 %_msprop_icmp = and i1 %11, %14, !dbg !20 60 br i1 %_msprop_icmp, label %15, label %16, !dbg !20, !prof !27 61 62 ; <label>:15 ; preds = %6 63 call void @__msan_warning_noreturn(), !dbg !20 64 call void asm sideeffect "", ""() #3, !dbg !20 65 unreachable, !dbg !20 66 67 ; <label>:16 ; preds = %6 68 %tobool = icmp eq i32 %7, 0, !dbg !20 69 br i1 %tobool, label %if.end, label %if.then, !dbg !20 70 71 if.then: ; preds = %16 72 store i64 0, i64* getelementptr inbounds ([1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !28 73 store i32 0, i32* bitcast ([8 x i64]* @__msan_retval_tls to i32*), align 8, !dbg !28 74 %puts = call i32 @puts(i8* getelementptr inbounds ([4 x i8]* @str, i64 0, i64 0)), !dbg !28 75 br label %if.end, !dbg !28 76 77 if.end: ; preds = %16, %if.then 78 ret void, !dbg !29 79 } 80 81 ; Function Attrs: nobuiltin 82 declare i8* @_Znwm(i64) #1 83 84 ; Function Attrs: sanitize_memory uwtable 85 define i32 @main() #0 { 86 entry: 87 %p.i = alloca i32*, align 8 88 %0 = ptrtoint i32** %p.i to i64, !dbg !30 89 %1 = and i64 %0, -70368744177672, !dbg !30 90 %2 = inttoptr i64 %1 to i64*, !dbg !30 91 store i64 -1, i64* %2, align 8, !dbg !30 92 %p.i.0..sroa_cast = bitcast i32** %p.i to i8*, !dbg !30 93 call void @llvm.lifetime.start(i64 8, i8* %p.i.0..sroa_cast), !dbg !30 94 store i64 0, i64* getelementptr inbounds ([1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !30 95 store i64 0, i64* getelementptr inbounds ([8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !30 96 %call.i = call i8* @_Znwm(i64 4) #4, !dbg !30 97 %_msret = load i64* getelementptr inbounds ([8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !30 98 %3 = bitcast i8* %call.i to i32*, !dbg !30 99 tail call void @llvm.dbg.value(metadata !{i32* %3}, i64 0, metadata !32), !dbg !30 100 %4 = inttoptr i64 %1 to i64*, !dbg !30 101 store i64 %_msret, i64* %4, align 8, !dbg !30 102 store volatile i32* %3, i32** %p.i, align 8, !dbg !30 103 tail call void @llvm.dbg.value(metadata !{i32** %p.i}, i64 0, metadata !32), !dbg !30 104 %p.i.0.p.0.p.0..i = load volatile i32** %p.i, align 8, !dbg !33 105 %_msld = load i64* %4, align 8, !dbg !33 106 %_mscmp = icmp eq i64 %_msld, 0, !dbg !33 107 br i1 %_mscmp, label %6, label %5, !dbg !33, !prof !22 108 109 ; <label>:5 ; preds = %entry 110 call void @__msan_warning_noreturn(), !dbg !33 111 call void asm sideeffect "", ""() #3, !dbg !33 112 unreachable, !dbg !33 113 114 ; <label>:6 ; preds = %entry 115 %7 = load i32* %p.i.0.p.0.p.0..i, align 4, !dbg !33, !tbaa !23 116 %8 = ptrtoint i32* %p.i.0.p.0.p.0..i to i64, !dbg !33 117 %9 = and i64 %8, -70368744177665, !dbg !33 118 %10 = inttoptr i64 %9 to i32*, !dbg !33 119 %_msld2 = load i32* %10, align 4, !dbg !33 120 %11 = icmp ne i32 %_msld2, 0, !dbg !33 121 %12 = xor i32 %_msld2, -1, !dbg !33 122 %13 = and i32 %7, %12, !dbg !33 123 %14 = icmp eq i32 %13, 0, !dbg !33 124 %_msprop_icmp = and i1 %11, %14, !dbg !33 125 br i1 %_msprop_icmp, label %15, label %16, !dbg !33, !prof !27 126 127 ; <label>:15 ; preds = %6 128 call void @__msan_warning_noreturn(), !dbg !33 129 call void asm sideeffect "", ""() #3, !dbg !33 130 unreachable, !dbg !33 131 132 ; <label>:16 ; preds = %6 133 %tobool.i = icmp eq i32 %7, 0, !dbg !33 134 br i1 %tobool.i, label %_Z1fv.exit, label %if.then.i, !dbg !33 135 136 if.then.i: ; preds = %16 137 store i64 0, i64* getelementptr inbounds ([1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !34 138 store i32 0, i32* bitcast ([8 x i64]* @__msan_retval_tls to i32*), align 8, !dbg !34 139 %puts.i = call i32 @puts(i8* getelementptr inbounds ([4 x i8]* @str, i64 0, i64 0)), !dbg !34 140 br label %_Z1fv.exit, !dbg !34 141 142 _Z1fv.exit: ; preds = %16, %if.then.i 143 call void @llvm.lifetime.end(i64 8, i8* %p.i.0..sroa_cast), !dbg !35 144 store i32 0, i32* bitcast ([8 x i64]* @__msan_retval_tls to i32*), align 8, !dbg !36 145 ret i32 0, !dbg !36 146 } 147 148 declare void @__msan_init() 149 150 ; Function Attrs: nounwind readnone 151 declare void @llvm.dbg.value(metadata, i64, metadata) #2 152 153 ; Function Attrs: nounwind 154 declare i32 @puts(i8* nocapture readonly) #3 155 156 ; Function Attrs: nounwind 157 declare void @llvm.lifetime.start(i64, i8* nocapture) #3 158 159 ; Function Attrs: nounwind 160 declare void @llvm.lifetime.end(i64, i8* nocapture) #3 161 162 declare void @__msan_warning_noreturn() 163 164 declare void @__msan_maybe_warning_1(i8, i32) 165 166 declare void @__msan_maybe_store_origin_1(i8, i8*, i32) 167 168 declare void @__msan_maybe_warning_2(i16, i32) 169 170 declare void @__msan_maybe_store_origin_2(i16, i8*, i32) 171 172 declare void @__msan_maybe_warning_4(i32, i32) 173 174 declare void @__msan_maybe_store_origin_4(i32, i8*, i32) 175 176 declare void @__msan_maybe_warning_8(i64, i32) 177 178 declare void @__msan_maybe_store_origin_8(i64, i8*, i32) 179 180 declare void @__msan_set_alloca_origin4(i8*, i64, i8*, i64) 181 182 declare void @__msan_poison_stack(i8*, i64) 183 184 declare i32 @__msan_chain_origin(i32) 185 186 declare i8* @__msan_memmove(i8*, i8*, i64) 187 188 declare i8* @__msan_memcpy(i8*, i8*, i64) 189 190 declare i8* @__msan_memset(i8*, i32, i64) 191 192 ; Function Attrs: nounwind 193 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #3 194 195 attributes #0 = { sanitize_memory uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 196 attributes #1 = { nobuiltin "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 197 attributes #2 = { nounwind readnone } 198 attributes #3 = { nounwind } 199 attributes #4 = { builtin } 200 201 !llvm.dbg.cu = !{!0} 202 !llvm.module.flags = !{!16, !17} 203 !llvm.ident = !{!18} 204 205 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5.0 (trunk 207243) (llvm/trunk 207259)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/foo.cpp] [DW_LANG_C_plus_plus] 206 !1 = metadata !{metadata !"foo.cpp", metadata !"/usr/local/google/home/echristo/tmp"} 207 !2 = metadata !{} 208 !3 = metadata !{metadata !4, metadata !13} 209 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"f", metadata !"f", metadata !"_Z1fv", i32 3, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, void ()* @_Z1fv, null, null, metadata !8, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [f] 210 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/usr/local/google/home/echristo/tmp/foo.cpp] 211 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 212 !7 = metadata !{null} 213 !8 = metadata !{metadata !9} 214 !9 = metadata !{i32 786688, metadata !4, metadata !"p", metadata !5, i32 4, metadata !10, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [p] [line 4] 215 !10 = metadata !{i32 786485, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_volatile_type ] [line 0, size 0, align 0, offset 0] [from ] 216 !11 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !12} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int] 217 !12 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] 218 !13 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 9, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 ()* @main, null, null, metadata !2, i32 9} ; [ DW_TAG_subprogram ] [line 9] [def] [main] 219 !14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 220 !15 = metadata !{metadata !12} 221 !16 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} 222 !17 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} 223 !18 = metadata !{metadata !"clang version 3.5.0 (trunk 207243) (llvm/trunk 207259)"} 224 !19 = metadata !{i32 4, i32 0, metadata !4, null} 225 !20 = metadata !{i32 5, i32 0, metadata !21, null} 226 !21 = metadata !{i32 786443, metadata !1, metadata !4, i32 5, i32 0, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/usr/local/google/home/echristo/tmp/foo.cpp] 227 !22 = metadata !{metadata !"branch_weights", i32 1000, i32 1} 228 !23 = metadata !{metadata !24, metadata !24, i64 0} 229 !24 = metadata !{metadata !"int", metadata !25, i64 0} 230 !25 = metadata !{metadata !"omnipotent char", metadata !26, i64 0} 231 !26 = metadata !{metadata !"Simple C/C++ TBAA"} 232 !27 = metadata !{metadata !"branch_weights", i32 1, i32 1000} 233 !28 = metadata !{i32 6, i32 0, metadata !21, null} 234 !29 = metadata !{i32 7, i32 0, metadata !4, null} 235 !30 = metadata !{i32 4, i32 0, metadata !4, metadata !31} 236 !31 = metadata !{i32 10, i32 0, metadata !13, null} 237 !32 = metadata !{i32 786688, metadata !4, metadata !"p", metadata !5, i32 4, metadata !10, i32 0, metadata !31} ; [ DW_TAG_auto_variable ] [p] [line 4] 238 !33 = metadata !{i32 5, i32 0, metadata !21, metadata !31} 239 !34 = metadata !{i32 6, i32 0, metadata !21, metadata !31} 240 !35 = metadata !{i32 7, i32 0, metadata !4, metadata !31} 241 !36 = metadata !{i32 11, i32 0, metadata !13, null} 242