1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

test/DebugInfo: Convert some tests to MIR

These tests are meant to test dwarf emission (or prolog/epilogue
generation) so we can convert them to .mir and only run the relevant
part of the pipeline.
This way they become independent of changes in earlier passes such as my
planned changes to RegAllocFast.

llvm-svn: 345919
This commit is contained in:
Matthias Braun 2018-11-02 01:31:52 +00:00
parent 5086da4ba2
commit 2a7ed68899
14 changed files with 1969 additions and 1089 deletions

View File

@ -1,324 +0,0 @@
; RUN: llc -O0 -fast-isel -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s
;
; Derived from (clang -O0 -g -fsanitize=address -fobjc-arc)
; @protocol NSObject
; @end
; @interface NSObject<NSObject>{}
; + (instancetype)alloc;
; @end
; struct CGSize {
; double width;
; double height;
; };
; typedef struct CGSize CGSize;
; @interface Object : NSObject
; - (instancetype)initWithSize:(CGSize)size;
; - (id)aMessage;
; @end
; @implementation MyObject
; + (id)doWithSize:(CGSize)imageSize andObject:(id)object {
; return [object aMessage];
; }
; @end
;
; CHECK: .debug_info contents:
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] ([[FN_END:.*]])
; CHECK: "_cmd"
; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location
; CHECK-NEXT: [0x{{0*}}, 0x{{.*}}):
; CHECK-NOT: DW_AT_
; CHECK: [0x{{.*}}, [[FN_END]]):
; CHECK-NEXT: DW_AT_name {{.*}}"imageSize"
; ModuleID = 'm.m'
source_filename = "m.m"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios"
%0 = type opaque
%struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* }
%struct._objc_cache = type opaque
%struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* }
%struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] }
%struct._objc_method = type { i8*, i8*, i8* }
%struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] }
%struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8**, i8*, %struct._prop_list_t* }
%struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] }
%struct._ivar_t = type { i32*, i8*, i8*, i32, i32 }
%struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] }
%struct._prop_t = type { i8*, i8* }
%struct.CGSize = type { double, double }
@"OBJC_CLASS_$_Object" = external global %struct._class_t
@"OBJC_CLASSLIST_REFERENCES_$_" = private global %struct._class_t* @"OBJC_CLASS_$_Object", section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [6 x i8] c"alloc\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_ = private externally_initialized global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @OBJC_METH_VAR_NAME_, i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip", align 8
@OBJC_METH_VAR_NAME_.1 = private unnamed_addr constant [14 x i8] c"initWithSize:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_.2 = private externally_initialized global i8* getelementptr inbounds ([14 x i8], [14 x i8]* @OBJC_METH_VAR_NAME_.1, i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip", align 8
@OBJC_METH_VAR_NAME_.3 = private unnamed_addr constant [9 x i8] c"aMessage\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_.4 = private externally_initialized global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_METH_VAR_NAME_.3, i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip", align 8
@_objc_empty_cache = external global %struct._objc_cache
@"OBJC_CLASS_$_MyObject" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_MyObject", %struct._class_t* null, %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** null, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_MyObject" }, section "__DATA, __objc_data", align 8
@"OBJC_METACLASS_$_MyObject" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_MyObject", %struct._class_t* @"OBJC_CLASS_$_MyObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** null, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_MyObject" }, section "__DATA, __objc_data", align 8
@OBJC_CLASS_NAME_ = private unnamed_addr constant [9 x i8] c"MyObject\00", section "__TEXT,__objc_classname,cstring_literals", align 1
@OBJC_METH_VAR_NAME_.5 = private unnamed_addr constant [12 x i8] c"doWithSize:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_METH_VAR_TYPE_ = private unnamed_addr constant [21 x i8] c"@32@0:8{CGSize=dd}16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1
@"\01l_OBJC_$_CLASS_METHODS_MyObject" = private global { i32, i32, [1 x %struct._objc_method] } { i32 24, i32 1, [1 x %struct._objc_method] [%struct._objc_method { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_.5, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @OBJC_METH_VAR_TYPE_, i32 0, i32 0), i8* bitcast (i8* (i8*, i8*, [2 x double])* @"\01+[MyObject doWithSize:]" to i8*) }] }, section "__DATA, __objc_const", align 8
@"\01l_OBJC_METACLASS_RO_$_MyObject" = private global %struct._class_ro_t { i32 131, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), %struct.__method_list_t* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CLASS_METHODS_MyObject" to %struct.__method_list_t*), %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8
@"\01l_OBJC_CLASS_RO_$_MyObject" = private global %struct._class_ro_t { i32 130, i32 0, i32 0, i8* null, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8
@"OBJC_LABEL_CLASS_$" = private global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_MyObject" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8
@llvm.compiler.used = appending global [12 x i8*] [i8* bitcast (%struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @OBJC_METH_VAR_NAME_, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_ to i8*), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @OBJC_METH_VAR_NAME_.1, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.2 to i8*), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_METH_VAR_NAME_.3, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.4 to i8*), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_.5, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @OBJC_METH_VAR_TYPE_, i32 0, i32 0), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CLASS_METHODS_MyObject" to i8*), i8* bitcast ([1 x i8*]* @"OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
@__asan_shadow_memory_dynamic_address = external global i64
@___asan_gen_ = private unnamed_addr constant [34 x i8] c"2 32 16 9 imageSize 64 8 6 object\00", align 1
; Function Attrs: noinline sanitize_address ssp uwtable
define internal i8* @"\01+[MyObject doWithSize:]"(i8* %self, i8* %_cmd, [2 x double] %imageSize.coerce) #0 !dbg !14 {
entry:
%0 = load i64, i64* @__asan_shadow_memory_dynamic_address
%self.addr = alloca i8*, align 8
%_cmd.addr = alloca i8*, align 8
%MyAlloca = alloca [96 x i8], align 32, !dbg !35
%1 = ptrtoint [96 x i8]* %MyAlloca to i64, !dbg !35
%2 = add i64 %1, 32, !dbg !35
%3 = inttoptr i64 %2 to %struct.CGSize*, !dbg !35
%4 = add i64 %1, 64, !dbg !35
%5 = inttoptr i64 %4 to %0**, !dbg !35
%6 = inttoptr i64 %1 to i64*, !dbg !35
store i64 1102416563, i64* %6, !dbg !35
%7 = add i64 %1, 8, !dbg !35
%8 = inttoptr i64 %7 to i64*, !dbg !35
store i64 ptrtoint ([34 x i8]* @___asan_gen_ to i64), i64* %8, !dbg !35
%9 = add i64 %1, 16, !dbg !35
%10 = inttoptr i64 %9 to i64*, !dbg !35
store i64 ptrtoint (i8* (i8*, i8*, [2 x double])* @"\01+[MyObject doWithSize:]" to i64), i64* %10, !dbg !35
%11 = lshr i64 %1, 3, !dbg !35
%12 = add i64 %11, %0, !dbg !35
%13 = add i64 %12, 0, !dbg !35
%14 = inttoptr i64 %13 to i64*, !dbg !35
store i64 -940689368107847183, i64* %14, align 1, !dbg !35
%15 = add i64 %12, 9, !dbg !35
%16 = inttoptr i64 %15 to i16*, !dbg !35
store i16 -3085, i16* %16, align 1, !dbg !35
%17 = add i64 %12, 11, !dbg !35
%18 = inttoptr i64 %17 to i8*, !dbg !35
store i8 -13, i8* %18, align 1, !dbg !35
call void @llvm.dbg.declare(metadata %struct.CGSize* %3, metadata !36, metadata !37), !dbg !38
call void @llvm.dbg.declare(metadata %0** %5, metadata !39, metadata !37), !dbg !45
%19 = bitcast %struct.CGSize* %3 to [2 x double]*
%20 = ptrtoint [2 x double]* %19 to i64
%21 = lshr i64 %20, 3
%22 = add i64 %21, %0
%23 = inttoptr i64 %22 to i16*
%24 = load i16, i16* %23
%25 = icmp ne i16 %24, 0
br i1 %25, label %26, label %27
; <label>:26: ; preds = %entry
call void @__asan_report_store16(i64 %20)
call void asm sideeffect "", ""()
unreachable
; <label>:27: ; preds = %entry
store [2 x double] %imageSize.coerce, [2 x double]* %19, align 8
store i8* %self, i8** %self.addr, align 8
call void @llvm.dbg.declare(metadata i8** %self.addr, metadata !46, metadata !48), !dbg !49
store i8* %_cmd, i8** %_cmd.addr, align 8
call void @llvm.dbg.declare(metadata i8** %_cmd.addr, metadata !50, metadata !48), !dbg !49
%28 = load %struct._class_t*, %struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_", align 8, !dbg !52
%29 = add i64 lshr (i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_ to i64), i64 3), %0, !dbg !52
%30 = inttoptr i64 %29 to i8*, !dbg !52
%31 = load i8, i8* %30, !dbg !52
%32 = icmp ne i8 %31, 0, !dbg !52
br i1 %32, label %33, label %34, !dbg !52
; <label>:33: ; preds = %27
call void @__asan_report_load8(i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_ to i64)), !dbg !52
call void asm sideeffect "", ""(), !dbg !52
unreachable, !dbg !52
; <label>:34: ; preds = %27
%35 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_, align 8, !dbg !52, !invariant.load !2
%36 = bitcast %struct._class_t* %28 to i8*, !dbg !52
%call = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %36, i8* %35), !dbg !52
%37 = bitcast i8* %call to %0*, !dbg !52
%38 = add i64 lshr (i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.2 to i64), i64 3), %0, !dbg !53
%39 = inttoptr i64 %38 to i8*, !dbg !53
%40 = load i8, i8* %39, !dbg !53
%41 = icmp ne i8 %40, 0, !dbg !53
br i1 %41, label %42, label %43, !dbg !53
; <label>:42: ; preds = %34
call void @__asan_report_load8(i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.2 to i64)), !dbg !53
call void asm sideeffect "", ""(), !dbg !53
unreachable, !dbg !53
; <label>:43: ; preds = %34
%44 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.2, align 8, !dbg !53, !invariant.load !2
%45 = bitcast %0* %37 to i8*, !dbg !53
%46 = bitcast %struct.CGSize* %3 to [2 x double]*, !dbg !53
%47 = ptrtoint [2 x double]* %46 to i64, !dbg !53
%48 = lshr i64 %47, 3, !dbg !53
%49 = add i64 %48, %0, !dbg !53
%50 = inttoptr i64 %49 to i16*, !dbg !53
%51 = load i16, i16* %50, !dbg !53
%52 = icmp ne i16 %51, 0, !dbg !53
br i1 %52, label %53, label %54, !dbg !53
; <label>:53: ; preds = %43
call void @__asan_report_load16(i64 %47), !dbg !53
call void asm sideeffect "", ""(), !dbg !53
unreachable, !dbg !53
; <label>:54: ; preds = %43
%55 = load [2 x double], [2 x double]* %46, align 8, !dbg !53
%call1 = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, [2 x double])*)(i8* %45, i8* %44, [2 x double] %55), !dbg !53
%56 = bitcast i8* %call1 to %0*, !dbg !53
%57 = ptrtoint %0** %5 to i64, !dbg !45
%58 = lshr i64 %57, 3, !dbg !45
%59 = add i64 %58, %0, !dbg !45
%60 = inttoptr i64 %59 to i8*, !dbg !45
%61 = load i8, i8* %60, !dbg !45
%62 = icmp ne i8 %61, 0, !dbg !45
br i1 %62, label %63, label %64, !dbg !45
; <label>:63: ; preds = %54
call void @__asan_report_store8(i64 %57), !dbg !45
call void asm sideeffect "", ""(), !dbg !45
unreachable, !dbg !45
; <label>:64: ; preds = %54
store %0* %56, %0** %5, align 8, !dbg !45
%65 = load %0*, %0** %5, align 8, !dbg !54
%66 = add i64 lshr (i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.4 to i64), i64 3), %0, !dbg !55
%67 = inttoptr i64 %66 to i8*, !dbg !55
%68 = load i8, i8* %67, !dbg !55
%69 = icmp ne i8 %68, 0, !dbg !55
br i1 %69, label %70, label %71, !dbg !55
; <label>:70: ; preds = %64
call void @__asan_report_load8(i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.4 to i64)), !dbg !55
call void asm sideeffect "", ""(), !dbg !55
unreachable, !dbg !55
; <label>:71: ; preds = %64
%72 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.4, align 8, !dbg !55, !invariant.load !2
%73 = bitcast %0* %65 to i8*, !dbg !55
%call2 = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %73, i8* %72), !dbg !55
call void asm sideeffect "mov\09fp, fp\09\09; marker for objc_retainAutoreleaseReturnValue", ""(), !dbg !55
%74 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call2) #3, !dbg !55
%75 = bitcast %0** %5 to i8**, !dbg !56
call void @objc_storeStrong(i8** %75, i8* null) #3, !dbg !56
%76 = tail call i8* @objc_autoreleaseReturnValue(i8* %74) #3, !dbg !56
store i64 1172321806, i64* %6, !dbg !56
%77 = add i64 %12, 0, !dbg !56
%78 = inttoptr i64 %77 to i64*, !dbg !56
store i64 0, i64* %78, align 1, !dbg !56
%79 = add i64 %12, 9, !dbg !56
%80 = inttoptr i64 %79 to i16*, !dbg !56
store i16 0, i16* %80, align 1, !dbg !56
%81 = add i64 %12, 11, !dbg !56
%82 = inttoptr i64 %81 to i8*, !dbg !56
store i8 0, i8* %82, align 1, !dbg !56
ret i8* %76, !dbg !56
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: nonlazybind
declare i8* @objc_msgSend(i8*, i8*, ...) #2
declare i8* @objc_retainAutoreleasedReturnValue(i8* returned)
declare void @objc_storeStrong(i8**, i8*)
declare i8* @objc_autoreleaseReturnValue(i8* returned)
define internal void @asan.module_ctor() {
call void @__asan_init()
call void @__asan_version_mismatch_check_v8()
ret void
}
declare void @__asan_init()
declare void @__asan_version_mismatch_check_v8()
declare void @__asan_report_load8(i64)
declare void @__asan_report_load16(i64)
declare void @__asan_report_store8(i64)
declare void @__asan_report_store16(i64)
attributes #0 = { noinline sanitize_address ssp uwtable }
attributes #1 = { nounwind readnone }
attributes #2 = { nonlazybind }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!5, !6, !7, !8, !9, !10, !11, !12}
!llvm.ident = !{!13}
!0 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !1, producer: "clang version 5.0.0 (trunk 295779) (llvm/trunk 295777)", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, enums: !2, retainedTypes: !3)
!1 = !DIFile(filename: "m.m", directory: "/")
!2 = !{}
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyObject", scope: !1, file: !1, line: 15, flags: DIFlagObjcClassComplete, elements: !2, runtimeLang: DW_LANG_ObjC)
!5 = !{i32 1, !"Objective-C Version", i32 2}
!6 = !{i32 1, !"Objective-C Image Info Version", i32 0}
!7 = !{i32 1, !"Objective-C Image Info Section", !"__DATA, __objc_imageinfo, regular, no_dead_strip"}
!8 = !{i32 4, !"Objective-C Garbage Collection", i32 0}
!9 = !{i32 1, !"Objective-C Class Properties", i32 64}
!10 = !{i32 2, !"Dwarf Version", i32 2}
!11 = !{i32 2, !"Debug Info Version", i32 3}
!12 = !{i32 1, !"PIC Level", i32 2}
!13 = !{!"clang version 5.0.0 (trunk 295779) (llvm/trunk 295777)"}
!14 = distinct !DISubprogram(name: "+[MyObject doWithSize:]", scope: !1, file: !1, line: 16, type: !15, isLocal: true, isDefinition: true, scopeLine: 16, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!15 = !DISubroutineType(types: !16)
!16 = !{!17, !24, !26, !29}
!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "id", file: !1, baseType: !18)
!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64)
!19 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_object", file: !1, elements: !20)
!20 = !{!21}
!21 = !DIDerivedType(tag: DW_TAG_member, name: "isa", scope: !19, file: !1, baseType: !22, size: 64)
!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64)
!23 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_class", file: !1, flags: DIFlagFwdDecl)
!24 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
!25 = !DIDerivedType(tag: DW_TAG_typedef, name: "Class", file: !1, baseType: !22)
!26 = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL", file: !1, baseType: !27, flags: DIFlagArtificial)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64)
!28 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_selector", file: !1, flags: DIFlagFwdDecl)
!29 = !DIDerivedType(tag: DW_TAG_typedef, name: "CGSize", file: !1, line: 10, baseType: !30)
!30 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CGSize", file: !1, line: 6, size: 128, elements: !31)
!31 = !{!32, !34}
!32 = !DIDerivedType(tag: DW_TAG_member, name: "width", scope: !30, file: !1, line: 7, baseType: !33, size: 64)
!33 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
!34 = !DIDerivedType(tag: DW_TAG_member, name: "height", scope: !30, file: !1, line: 8, baseType: !33, size: 64, offset: 64)
!35 = !DILocation(line: 16, scope: !14)
!36 = !DILocalVariable(name: "imageSize", arg: 3, scope: !14, file: !1, line: 16, type: !29)
!37 = !DIExpression(DW_OP_deref)
!38 = !DILocation(line: 16, column: 26, scope: !14)
!39 = !DILocalVariable(name: "object", scope: !14, file: !1, line: 17, type: !40)
!40 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !41, size: 64)
!41 = !DICompositeType(tag: DW_TAG_structure_type, name: "Object", scope: !1, file: !1, line: 11, elements: !42, runtimeLang: DW_LANG_ObjC)
!42 = !{!43}
!43 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !41, baseType: !44)
!44 = !DICompositeType(tag: DW_TAG_structure_type, name: "NSObject", scope: !1, file: !1, line: 3, elements: !2, runtimeLang: DW_LANG_ObjC)
!45 = !DILocation(line: 17, column: 11, scope: !14)
!46 = !DILocalVariable(name: "self", arg: 1, scope: !14, type: !47, flags: DIFlagArtificial | DIFlagObjectPointer)
!47 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !25)
!48 = !DIExpression()
!49 = !DILocation(line: 0, scope: !14)
!50 = !DILocalVariable(name: "_cmd", arg: 2, scope: !14, type: !51, flags: DIFlagArtificial)
!51 = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL", file: !1, baseType: !27)
!52 = !DILocation(line: 17, column: 21, scope: !14)
!53 = !DILocation(line: 17, column: 20, scope: !14)
!54 = !DILocation(line: 18, column: 11, scope: !14)
!55 = !DILocation(line: 18, column: 10, scope: !14)
!56 = !DILocation(line: 19, column: 1, scope: !14)

View File

@ -0,0 +1,682 @@
# RUN: llc -O0 -start-before=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s
#
# Derived from (clang -O0 -g -fsanitize=address -fobjc-arc)
# @protocol NSObject
# @end
# @interface NSObject<NSObject>{}
# + (instancetype)alloc;
# @end
# struct CGSize {
# double width;
# double height;
# };
# typedef struct CGSize CGSize;
# @interface Object : NSObject
# - (instancetype)initWithSize:(CGSize)size;
# - (id)aMessage;
# @end
# @implementation MyObject
# + (id)doWithSize:(CGSize)imageSize andObject:(id)object {
# return [object aMessage];
# }
# @end
#
# CHECK: .debug_info contents:
# CHECK: DW_TAG_subprogram
# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
# CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] ([[FN_END:.*]])
# CHECK: "_cmd"
# CHECK: DW_TAG_formal_parameter
# CHECK-NEXT: DW_AT_location
# CHECK-NEXT: [0x{{0*}}, 0x{{.*}}):
# CHECK-NOT: DW_AT_
# CHECK: [0x{{.*}}, [[FN_END]]):
# CHECK-NEXT: DW_AT_name {{.*}}"imageSize"
--- |
; ModuleID = 'test/DebugInfo/AArch64/asan-stack-vars.ll'
source_filename = "m.m"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios"
%0 = type opaque
%struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* }
%struct._objc_cache = type opaque
%struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* }
%struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] }
%struct._objc_method = type { i8*, i8*, i8* }
%struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] }
%struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8**, i8*, %struct._prop_list_t* }
%struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] }
%struct._ivar_t = type { i32*, i8*, i8*, i32, i32 }
%struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] }
%struct._prop_t = type { i8*, i8* }
%struct.CGSize = type { double, double }
@"OBJC_CLASS_$_Object" = external global %struct._class_t
@"OBJC_CLASSLIST_REFERENCES_$_" = private global %struct._class_t* @"OBJC_CLASS_$_Object", section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [6 x i8] c"alloc\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_ = private externally_initialized global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @OBJC_METH_VAR_NAME_, i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip", align 8
@OBJC_METH_VAR_NAME_.1 = private unnamed_addr constant [14 x i8] c"initWithSize:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_.2 = private externally_initialized global i8* getelementptr inbounds ([14 x i8], [14 x i8]* @OBJC_METH_VAR_NAME_.1, i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip", align 8
@OBJC_METH_VAR_NAME_.3 = private unnamed_addr constant [9 x i8] c"aMessage\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_.4 = private externally_initialized global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_METH_VAR_NAME_.3, i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip", align 8
@_objc_empty_cache = external global %struct._objc_cache
@"OBJC_CLASS_$_MyObject" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_MyObject", %struct._class_t* null, %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** null, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_MyObject" }, section "__DATA, __objc_data", align 8
@"OBJC_METACLASS_$_MyObject" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_MyObject", %struct._class_t* @"OBJC_CLASS_$_MyObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** null, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_MyObject" }, section "__DATA, __objc_data", align 8
@OBJC_CLASS_NAME_ = private unnamed_addr constant [9 x i8] c"MyObject\00", section "__TEXT,__objc_classname,cstring_literals", align 1
@OBJC_METH_VAR_NAME_.5 = private unnamed_addr constant [12 x i8] c"doWithSize:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_METH_VAR_TYPE_ = private unnamed_addr constant [21 x i8] c"@32@0:8{CGSize=dd}16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1
@"\01l_OBJC_$_CLASS_METHODS_MyObject" = private global { i32, i32, [1 x %struct._objc_method] } { i32 24, i32 1, [1 x %struct._objc_method] [%struct._objc_method { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_.5, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @OBJC_METH_VAR_TYPE_, i32 0, i32 0), i8* bitcast (i8* (i8*, i8*, [2 x double])* @"\01+[MyObject doWithSize:]" to i8*) }] }, section "__DATA, __objc_const", align 8
@"\01l_OBJC_METACLASS_RO_$_MyObject" = private global %struct._class_ro_t { i32 131, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), %struct.__method_list_t* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CLASS_METHODS_MyObject" to %struct.__method_list_t*), %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8
@"\01l_OBJC_CLASS_RO_$_MyObject" = private global %struct._class_ro_t { i32 130, i32 0, i32 0, i8* null, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8
@"OBJC_LABEL_CLASS_$" = private global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_MyObject" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8
@llvm.compiler.used = appending global [12 x i8*] [i8* bitcast (%struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @OBJC_METH_VAR_NAME_, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_ to i8*), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @OBJC_METH_VAR_NAME_.1, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.2 to i8*), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_METH_VAR_NAME_.3, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.4 to i8*), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_.5, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @OBJC_METH_VAR_TYPE_, i32 0, i32 0), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CLASS_METHODS_MyObject" to i8*), i8* bitcast ([1 x i8*]* @"OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
@__asan_shadow_memory_dynamic_address = external global i64
@___asan_gen_ = private unnamed_addr constant [34 x i8] c"2 32 16 9 imageSize 64 8 6 object\00", align 1
@__stack_chk_guard = external global i8*
; Function Attrs: noinline sanitize_address ssp uwtable
define internal i8* @"\01+[MyObject doWithSize:]"(i8* %self, i8* %_cmd, [2 x double] %imageSize.coerce) #0 !dbg !14 {
entry:
%StackGuardSlot = alloca i8*
%0 = call i8* @llvm.stackguard()
call void @llvm.stackprotector(i8* %0, i8** %StackGuardSlot)
%1 = load i64, i64* @__asan_shadow_memory_dynamic_address
%self.addr = alloca i8*, align 8
%_cmd.addr = alloca i8*, align 8
%MyAlloca = alloca [96 x i8], align 32, !dbg !35
%2 = ptrtoint [96 x i8]* %MyAlloca to i64, !dbg !35
%3 = add i64 %2, 32, !dbg !35
%4 = inttoptr i64 %3 to %struct.CGSize*, !dbg !35
%5 = add i64 %2, 64, !dbg !35
%6 = inttoptr i64 %5 to %0**, !dbg !35
%7 = inttoptr i64 %2 to i64*, !dbg !35
store i64 1102416563, i64* %7, !dbg !35
%8 = add i64 %2, 8, !dbg !35
%9 = inttoptr i64 %8 to i64*, !dbg !35
store i64 ptrtoint ([34 x i8]* @___asan_gen_ to i64), i64* %9, !dbg !35
%10 = add i64 %2, 16, !dbg !35
%11 = inttoptr i64 %10 to i64*, !dbg !35
store i64 ptrtoint (i8* (i8*, i8*, [2 x double])* @"\01+[MyObject doWithSize:]" to i64), i64* %11, !dbg !35
%12 = lshr i64 %2, 3, !dbg !35
%13 = add i64 %12, %1, !dbg !35
%14 = add i64 %13, 0, !dbg !35
%15 = inttoptr i64 %14 to i64*, !dbg !35
store i64 -940689368107847183, i64* %15, align 1, !dbg !35
%16 = add i64 %13, 9, !dbg !35
%17 = inttoptr i64 %16 to i16*, !dbg !35
store i16 -3085, i16* %17, align 1, !dbg !35
%18 = add i64 %13, 11, !dbg !35
%19 = inttoptr i64 %18 to i8*, !dbg !35
store i8 -13, i8* %19, align 1, !dbg !35
call void @llvm.dbg.declare(metadata %struct.CGSize* %4, metadata !36, metadata !DIExpression(DW_OP_deref)), !dbg !37
call void @llvm.dbg.declare(metadata %0** %6, metadata !38, metadata !DIExpression(DW_OP_deref)), !dbg !44
%20 = bitcast %struct.CGSize* %4 to [2 x double]*
%21 = ptrtoint [2 x double]* %20 to i64
%22 = lshr i64 %21, 3
%23 = add i64 %22, %1
%24 = inttoptr i64 %23 to i16*
%25 = load i16, i16* %24
%26 = icmp ne i16 %25, 0
br i1 %26, label %27, label %28
; <label>:27: ; preds = %entry
call void @__asan_report_store16(i64 %21)
call void asm sideeffect "", ""()
unreachable
; <label>:28: ; preds = %entry
store [2 x double] %imageSize.coerce, [2 x double]* %20, align 8
store i8* %self, i8** %self.addr, align 8
call void @llvm.dbg.declare(metadata i8** %self.addr, metadata !45, metadata !DIExpression()), !dbg !47
store i8* %_cmd, i8** %_cmd.addr, align 8
call void @llvm.dbg.declare(metadata i8** %_cmd.addr, metadata !48, metadata !DIExpression()), !dbg !47
%29 = load %struct._class_t*, %struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_", align 8, !dbg !50
%30 = add i64 lshr (i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_ to i64), i64 3), %1, !dbg !50
%31 = inttoptr i64 %30 to i8*, !dbg !50
%32 = load i8, i8* %31, !dbg !50
%33 = icmp ne i8 %32, 0, !dbg !50
br i1 %33, label %34, label %35, !dbg !50
; <label>:34: ; preds = %28
call void @__asan_report_load8(i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_ to i64)), !dbg !50
call void asm sideeffect "", ""(), !dbg !50
unreachable, !dbg !50
; <label>:35: ; preds = %28
%36 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_, align 8, !dbg !50, !invariant.load !2
%37 = bitcast %struct._class_t* %29 to i8*, !dbg !50
%call = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %37, i8* %36), !dbg !50
%38 = bitcast i8* %call to %0*, !dbg !50
%39 = add i64 lshr (i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.2 to i64), i64 3), %1, !dbg !51
%40 = inttoptr i64 %39 to i8*, !dbg !51
%41 = load i8, i8* %40, !dbg !51
%42 = icmp ne i8 %41, 0, !dbg !51
br i1 %42, label %43, label %44, !dbg !51
; <label>:43: ; preds = %35
call void @__asan_report_load8(i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.2 to i64)), !dbg !51
call void asm sideeffect "", ""(), !dbg !51
unreachable, !dbg !51
; <label>:44: ; preds = %35
%45 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.2, align 8, !dbg !51, !invariant.load !2
%46 = bitcast %0* %38 to i8*, !dbg !51
%47 = bitcast %struct.CGSize* %4 to [2 x double]*, !dbg !51
%48 = ptrtoint [2 x double]* %47 to i64, !dbg !51
%49 = lshr i64 %48, 3, !dbg !51
%50 = add i64 %49, %1, !dbg !51
%51 = inttoptr i64 %50 to i16*, !dbg !51
%52 = load i16, i16* %51, !dbg !51
%53 = icmp ne i16 %52, 0, !dbg !51
br i1 %53, label %54, label %55, !dbg !51
; <label>:54: ; preds = %44
call void @__asan_report_load16(i64 %48), !dbg !51
call void asm sideeffect "", ""(), !dbg !51
unreachable, !dbg !51
; <label>:55: ; preds = %44
%56 = load [2 x double], [2 x double]* %47, align 8, !dbg !51
%call1 = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, [2 x double])*)(i8* %46, i8* %45, [2 x double] %56), !dbg !51
%57 = bitcast i8* %call1 to %0*, !dbg !51
%58 = ptrtoint %0** %6 to i64, !dbg !44
%59 = lshr i64 %58, 3, !dbg !44
%60 = add i64 %59, %1, !dbg !44
%61 = inttoptr i64 %60 to i8*, !dbg !44
%62 = load i8, i8* %61, !dbg !44
%63 = icmp ne i8 %62, 0, !dbg !44
br i1 %63, label %64, label %65, !dbg !44
; <label>:64: ; preds = %55
call void @__asan_report_store8(i64 %58), !dbg !44
call void asm sideeffect "", ""(), !dbg !44
unreachable, !dbg !44
; <label>:65: ; preds = %55
store %0* %57, %0** %6, align 8, !dbg !44
%66 = load %0*, %0** %6, align 8, !dbg !52
%67 = add i64 lshr (i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.4 to i64), i64 3), %1, !dbg !53
%68 = inttoptr i64 %67 to i8*, !dbg !53
%69 = load i8, i8* %68, !dbg !53
%70 = icmp ne i8 %69, 0, !dbg !53
br i1 %70, label %71, label %72, !dbg !53
; <label>:71: ; preds = %65
call void @__asan_report_load8(i64 ptrtoint (i8** @OBJC_SELECTOR_REFERENCES_.4 to i64)), !dbg !53
call void asm sideeffect "", ""(), !dbg !53
unreachable, !dbg !53
; <label>:72: ; preds = %65
%73 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.4, align 8, !dbg !53, !invariant.load !2
%74 = bitcast %0* %66 to i8*, !dbg !53
%call2 = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %74, i8* %73), !dbg !53
call void asm sideeffect "mov\09fp, fp\09\09; marker for objc_retainAutoreleaseReturnValue", ""(), !dbg !53
%75 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call2) #3, !dbg !53
%76 = bitcast %0** %6 to i8**, !dbg !54
call void @objc_storeStrong(i8** %76, i8* null) #3, !dbg !54
%77 = tail call i8* @objc_autoreleaseReturnValue(i8* %75) #3, !dbg !54
store i64 1172321806, i64* %7, !dbg !54
%78 = add i64 %13, 0, !dbg !54
%79 = inttoptr i64 %78 to i64*, !dbg !54
store i64 0, i64* %79, align 1, !dbg !54
%80 = add i64 %13, 9, !dbg !54
%81 = inttoptr i64 %80 to i16*, !dbg !54
store i16 0, i16* %81, align 1, !dbg !54
%82 = add i64 %13, 11, !dbg !54
%83 = inttoptr i64 %82 to i8*, !dbg !54
store i8 0, i8* %83, align 1, !dbg !54
%84 = call i8* @llvm.stackguard()
%85 = load volatile i8*, i8** %StackGuardSlot
%86 = icmp eq i8* %84, %85
br i1 %86, label %SP_return, label %CallStackCheckFailBlk, !prof !55
SP_return: ; preds = %72
ret i8* %77, !dbg !54
CallStackCheckFailBlk: ; preds = %72
call void @__stack_chk_fail(), !dbg !47
unreachable, !dbg !47
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: nonlazybind
declare i8* @objc_msgSend(i8*, i8*, ...) #2
declare i8* @objc_retainAutoreleasedReturnValue(i8* returned)
declare void @objc_storeStrong(i8**, i8*)
declare i8* @objc_autoreleaseReturnValue(i8* returned)
define internal void @asan.module_ctor() {
call void @__asan_init()
call void @__asan_version_mismatch_check_v8()
ret void
}
declare void @__asan_init()
declare void @__asan_version_mismatch_check_v8()
declare void @__asan_report_load8(i64)
declare void @__asan_report_load16(i64)
declare void @__asan_report_store8(i64)
declare void @__asan_report_store16(i64)
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #3
; Function Attrs: nounwind
declare i8* @llvm.stackguard() #3
declare void @__stack_chk_fail()
attributes #0 = { noinline sanitize_address ssp uwtable }
attributes #1 = { nounwind readnone speculatable }
attributes #2 = { nonlazybind }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!5, !6, !7, !8, !9, !10, !11, !12}
!llvm.ident = !{!13}
!0 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !1, producer: "clang version 5.0.0 (trunk 295779) (llvm/trunk 295777)", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, enums: !2, retainedTypes: !3)
!1 = !DIFile(filename: "m.m", directory: "/")
!2 = !{}
!3 = !{!4}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyObject", scope: !1, file: !1, line: 15, flags: DIFlagObjcClassComplete, elements: !2, runtimeLang: DW_LANG_ObjC)
!5 = !{i32 1, !"Objective-C Version", i32 2}
!6 = !{i32 1, !"Objective-C Image Info Version", i32 0}
!7 = !{i32 1, !"Objective-C Image Info Section", !"__DATA,__objc_imageinfo,regular,no_dead_strip"}
!8 = !{i32 4, !"Objective-C Garbage Collection", i32 0}
!9 = !{i32 1, !"Objective-C Class Properties", i32 64}
!10 = !{i32 2, !"Dwarf Version", i32 2}
!11 = !{i32 2, !"Debug Info Version", i32 3}
!12 = !{i32 7, !"PIC Level", i32 2}
!13 = !{!"clang version 5.0.0 (trunk 295779) (llvm/trunk 295777)"}
!14 = distinct !DISubprogram(name: "+[MyObject doWithSize:]", scope: !1, file: !1, line: 16, type: !15, isLocal: true, isDefinition: true, scopeLine: 16, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!15 = !DISubroutineType(types: !16)
!16 = !{!17, !24, !26, !29}
!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "id", file: !1, baseType: !18)
!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64)
!19 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_object", file: !1, elements: !20)
!20 = !{!21}
!21 = !DIDerivedType(tag: DW_TAG_member, name: "isa", scope: !19, file: !1, baseType: !22, size: 64)
!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64)
!23 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_class", file: !1, flags: DIFlagFwdDecl)
!24 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
!25 = !DIDerivedType(tag: DW_TAG_typedef, name: "Class", file: !1, baseType: !22)
!26 = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL", file: !1, baseType: !27, flags: DIFlagArtificial)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64)
!28 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_selector", file: !1, flags: DIFlagFwdDecl)
!29 = !DIDerivedType(tag: DW_TAG_typedef, name: "CGSize", file: !1, line: 10, baseType: !30)
!30 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CGSize", file: !1, line: 6, size: 128, elements: !31)
!31 = !{!32, !34}
!32 = !DIDerivedType(tag: DW_TAG_member, name: "width", scope: !30, file: !1, line: 7, baseType: !33, size: 64)
!33 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
!34 = !DIDerivedType(tag: DW_TAG_member, name: "height", scope: !30, file: !1, line: 8, baseType: !33, size: 64, offset: 64)
!35 = !DILocation(line: 16, scope: !14)
!36 = !DILocalVariable(name: "imageSize", arg: 3, scope: !14, file: !1, line: 16, type: !29)
!37 = !DILocation(line: 16, column: 26, scope: !14)
!38 = !DILocalVariable(name: "object", scope: !14, file: !1, line: 17, type: !39)
!39 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !40, size: 64)
!40 = !DICompositeType(tag: DW_TAG_structure_type, name: "Object", scope: !1, file: !1, line: 11, elements: !41, runtimeLang: DW_LANG_ObjC)
!41 = !{!42}
!42 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !40, baseType: !43)
!43 = !DICompositeType(tag: DW_TAG_structure_type, name: "NSObject", scope: !1, file: !1, line: 3, elements: !2, runtimeLang: DW_LANG_ObjC)
!44 = !DILocation(line: 17, column: 11, scope: !14)
!45 = !DILocalVariable(name: "self", arg: 1, scope: !14, type: !46, flags: DIFlagArtificial | DIFlagObjectPointer)
!46 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !25)
!47 = !DILocation(line: 0, scope: !14)
!48 = !DILocalVariable(name: "_cmd", arg: 2, scope: !14, type: !49, flags: DIFlagArtificial)
!49 = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL", file: !1, baseType: !27)
!50 = !DILocation(line: 17, column: 21, scope: !14)
!51 = !DILocation(line: 17, column: 20, scope: !14)
!52 = !DILocation(line: 18, column: 11, scope: !14)
!53 = !DILocation(line: 18, column: 10, scope: !14)
!54 = !DILocation(line: 19, column: 1, scope: !14)
!55 = !{!"branch_weights", i32 2147481600, i32 2048}
...
---
name: "\x01+[MyObject doWithSize:]"
alignment: 2
tracksRegLiveness: true
liveins:
- { reg: '$x0' }
- { reg: '$x1' }
- { reg: '$d0' }
- { reg: '$d1' }
frameInfo:
stackSize: 352
maxAlignment: 32
adjustsStack: true
hasCalls: true
stackProtector: '%stack.0.StackGuardSlot'
maxCallFrameSize: 0
localFrameSize: 144
stack:
- { id: 0, name: StackGuardSlot, offset: -40, size: 8, alignment: 8,
stack-id: 0, local-offset: -8 }
- { id: 1, name: self.addr, offset: -168, size: 8, alignment: 8, stack-id: 0,
local-offset: -136, debug-info-variable: '!45', debug-info-expression: '!DIExpression()',
debug-info-location: '!47' }
- { id: 2, name: _cmd.addr, offset: -176, size: 8, alignment: 8, stack-id: 0,
local-offset: -144, debug-info-variable: '!48', debug-info-expression: '!DIExpression()',
debug-info-location: '!47' }
- { id: 3, name: MyAlloca, offset: -160, size: 96, alignment: 32, stack-id: 0,
local-offset: -128 }
- { id: 4, type: spill-slot, offset: -184, size: 8, alignment: 8, stack-id: 0 }
- { id: 5, type: spill-slot, offset: -192, size: 8, alignment: 8, stack-id: 0 }
- { id: 6, type: spill-slot, offset: -200, size: 8, alignment: 8, stack-id: 0 }
- { id: 7, type: spill-slot, offset: -208, size: 8, alignment: 8, stack-id: 0 }
- { id: 8, type: spill-slot, offset: -216, size: 8, alignment: 8, stack-id: 0 }
- { id: 9, type: spill-slot, offset: -224, size: 8, alignment: 8, stack-id: 0 }
- { id: 10, type: spill-slot, offset: -232, size: 8, alignment: 8, stack-id: 0 }
- { id: 11, type: spill-slot, offset: -240, size: 8, alignment: 8, stack-id: 0 }
- { id: 12, type: spill-slot, offset: -248, size: 8, alignment: 8, stack-id: 0 }
- { id: 13, type: spill-slot, offset: -256, size: 8, alignment: 8, stack-id: 0 }
- { id: 14, type: spill-slot, offset: -264, size: 8, alignment: 8, stack-id: 0 }
- { id: 15, type: spill-slot, offset: -272, size: 8, alignment: 8, stack-id: 0 }
- { id: 16, type: spill-slot, offset: -280, size: 8, alignment: 8, stack-id: 0 }
- { id: 17, type: spill-slot, offset: -288, size: 8, alignment: 8, stack-id: 0 }
- { id: 18, type: spill-slot, offset: -296, size: 8, alignment: 8, stack-id: 0 }
- { id: 19, type: spill-slot, offset: -304, size: 8, alignment: 8, stack-id: 0 }
- { id: 20, type: spill-slot, offset: -312, size: 8, alignment: 8, stack-id: 0 }
- { id: 21, type: spill-slot, offset: -320, size: 8, alignment: 8, stack-id: 0 }
- { id: 22, type: spill-slot, offset: -328, size: 8, alignment: 8, stack-id: 0 }
- { id: 23, type: spill-slot, offset: -336, size: 8, alignment: 8, stack-id: 0 }
- { id: 24, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$lr' }
- { id: 25, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$fp' }
- { id: 26, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$x27' }
- { id: 27, type: spill-slot, offset: -32, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$x28' }
body: |
bb.0.entry:
liveins: $x0, $x1, $d0, $d1, $x27, $x28, $lr
early-clobber $sp = frame-setup STPXpre killed $x28, killed $x27, $sp, -4 :: (store 8 into %stack.27), (store 8 into %stack.26)
frame-setup STPXi killed $fp, killed $lr, $sp, 2 :: (store 8 into %stack.25), (store 8 into %stack.24)
$fp = frame-setup ADDXri $sp, 16, 0
$x9 = frame-setup SUBXri $sp, 320, 0
$sp = ANDXri killed $x9, 7930
frame-setup CFI_INSTRUCTION def_cfa $w29, 16
frame-setup CFI_INSTRUCTION offset $w30, -8
frame-setup CFI_INSTRUCTION offset $w29, -16
frame-setup CFI_INSTRUCTION offset $w27, -24
frame-setup CFI_INSTRUCTION offset $w28, -32
renamable $x8 = ADRP target-flags(aarch64-page) @"\01+[MyObject doWithSize:]"
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @"\01+[MyObject doWithSize:]", 0
renamable $x9 = ADRP target-flags(aarch64-page) @___asan_gen_
renamable $x9 = ADDXri killed renamable $x9, target-flags(aarch64-pageoff, aarch64-nc) @___asan_gen_, 0
$x10 = ADDXri $sp, 192, 0
renamable $x11 = ADRP target-flags(aarch64-page, aarch64-got) @__asan_shadow_memory_dynamic_address
renamable $x11 = LDRXui killed renamable $x11, target-flags(aarch64-pageoff, aarch64-got, aarch64-nc) @__asan_shadow_memory_dynamic_address
$x12 = ADRP target-flags(aarch64-page, aarch64-got) @__stack_chk_guard
$x12 = LDRXui $x12, target-flags(aarch64-pageoff, aarch64-got, aarch64-nc) @__stack_chk_guard
$x12 = LDRXui killed $x12, 0 :: (dereferenceable invariant load 8 from @__stack_chk_guard)
$x13 = ADRP target-flags(aarch64-page, aarch64-got) @__stack_chk_guard
$x13 = LDRXui $x13, target-flags(aarch64-pageoff, aarch64-got, aarch64-nc) @__stack_chk_guard
$x13 = LDRXui killed $x13, 0 :: (dereferenceable invariant load 8 from @__stack_chk_guard)
STRXui killed renamable $x13, $sp, 39 :: (volatile store 8 into %stack.0.StackGuardSlot)
renamable $x11 = LDRXui killed renamable $x11, 0 :: (load 8 from @__asan_shadow_memory_dynamic_address)
renamable $x13 = ADDXri renamable $x10, 32, 0, debug-location !35
renamable $x14 = ADDXri renamable $x10, 64, 0, debug-location !35
$x15 = MOVZXi 35507, 0, debug-location !35
$x15 = MOVKXi $x15, 16821, 16, debug-location !35
STRXui killed renamable $x15, $sp, 24, debug-location !35 :: (store 96 into %stack.3.MyAlloca, align 32)
STRXui killed renamable $x9, $sp, 25, debug-location !35 :: (store 96 into %stack.3.MyAlloca + 1, align 32)
STRXui killed renamable $x8, $sp, 26, debug-location !35 :: (store 96 into %stack.3.MyAlloca + 2, align 32)
renamable $x8 = UBFMXri renamable $x10, 3, 63, debug-location !35
renamable $x9 = ADDXrs renamable $x11, renamable $x10, 67, debug-location !35
$x15 = MOVZXi 61937, 0, debug-location !35
$x15 = MOVKXi $x15, 61937, 16, debug-location !35
$x15 = MOVKXi $x15, 62194, 48, debug-location !35
STRXroX killed renamable $x15, renamable $x8, renamable $x11, 0, 0, debug-location !35 :: (store 8 into %ir.15, align 1)
renamable $x15 = ADDXrs renamable $x8, renamable $x11, 0, debug-location !35
$w16 = MOVZWi 62451, 0, debug-location !35
STURHHi killed renamable $w16, killed renamable $x15, 9, debug-location !35 :: (store 2 into %ir.17, align 1)
renamable $x8 = ADDXrs killed renamable $x8, renamable $x11, 0, debug-location !35
$w16 = MOVZWi 243, 0, debug-location !35
STRBBui killed renamable $w16, killed renamable $x8, 11, debug-location !35 :: (store 1 into %ir.19)
DBG_VALUE renamable $x13, 0, !36, !DIExpression(DW_OP_deref), debug-location !37
DBG_VALUE renamable $x14, 0, !38, !DIExpression(DW_OP_deref), debug-location !44
$x8 = ORRXrs $xzr, $x13, 0
renamable $x15 = UBFMXri renamable $x8, 3, 63
renamable $w16 = LDRHHroX killed renamable $x15, renamable $x11, 0, 0 :: (load 2 from %ir.24)
renamable $w16 = UBFMWri killed renamable $w16, 0, 15
STRXui killed $x1, $sp, 21 :: (store 8 into %stack.4)
STRDui killed $d1, $sp, 20 :: (store 8 into %stack.5)
STRDui killed $d0, $sp, 19 :: (store 8 into %stack.6)
STRXui killed $x0, $sp, 18 :: (store 8 into %stack.7)
STRXui killed $x13, $sp, 17 :: (store 8 into %stack.8)
DBG_VALUE $sp, 0, !36, !DIExpression(DW_OP_plus_uconst, 136, DW_OP_deref, DW_OP_deref), debug-location !37
STRXui killed $x14, $sp, 16 :: (store 8 into %stack.9)
DBG_VALUE $sp, 0, !38, !DIExpression(DW_OP_plus_uconst, 128, DW_OP_deref, DW_OP_deref), debug-location !44
STRXui killed $x10, $sp, 15 :: (store 8 into %stack.10)
STRXui killed $x12, $sp, 14 :: (store 8 into %stack.11)
STRXui killed $x11, $sp, 13 :: (store 8 into %stack.12)
STRXui killed $x9, $sp, 12 :: (store 8 into %stack.13)
STRXui killed $x8, $sp, 11 :: (store 8 into %stack.14)
CBZW killed renamable $w16, %bb.2
bb.1 (%ir-block.27):
successors:
$x0 = LDRXui $sp, 11 :: (load 8 from %stack.14)
BL @__asan_report_store16, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp
INLINEASM &"", 1
BRK 1
bb.2 (%ir-block.28):
renamable $x8 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_, 0
renamable $x9 = ORRXri $xzr, 4097
renamable $x8 = LSRVXr killed renamable $x8, killed renamable $x9
renamable $x9 = ADRP target-flags(aarch64-page) @"OBJC_CLASSLIST_REFERENCES_$_"
renamable $x9 = ADDXri killed renamable $x9, target-flags(aarch64-pageoff, aarch64-nc) @"OBJC_CLASSLIST_REFERENCES_$_", 0
$d0 = LDRDui $sp, 19 :: (load 8 from %stack.6)
$x10 = LDRXui $sp, 11 :: (load 8 from %stack.14)
STRDui killed renamable $d0, renamable $x10, 0 :: (store 8 into %ir.20)
$d1 = LDRDui $sp, 20 :: (load 8 from %stack.5)
STRDui killed renamable $d1, killed renamable $x10, 1 :: (store 8 into %ir.20 + 8)
$x11 = LDRXui $sp, 18 :: (load 8 from %stack.7)
STRXui killed renamable $x11, $sp, 23 :: (store 8 into %stack.1.self.addr)
$x12 = LDRXui $sp, 21 :: (load 8 from %stack.4)
STRXui killed renamable $x12, $sp, 22 :: (store 8 into %stack.2._cmd.addr)
renamable $x9 = LDRXui killed renamable $x9, 0, debug-location !50 :: (load 8 from @"OBJC_CLASSLIST_REFERENCES_$_")
$x13 = LDRXui $sp, 13 :: (load 8 from %stack.12)
renamable $w14 = LDRBBroX killed renamable $x8, killed renamable $x13, 0, 0, debug-location !50 :: (load 1 from %ir.31)
renamable $w14 = UBFMWri killed renamable $w14, 0, 7, debug-location !50
STRXui killed $x9, $sp, 10 :: (store 8 into %stack.15)
CBZW killed renamable $w14, %bb.4, debug-location !50
bb.3 (%ir-block.34):
successors:
$x0 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_, debug-location !50
renamable $x0 = ADDXri $x0, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_, 0, debug-location !50
BL @__asan_report_load8, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !50
INLINEASM &"", 1, debug-location !50
BRK 1, debug-location !50
bb.4 (%ir-block.35):
renamable $x8 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_, 0
renamable $x1 = LDRXui killed renamable $x8, 0, debug-location !50 :: (invariant load 8 from @OBJC_SELECTOR_REFERENCES_)
$x8 = LDRXui $sp, 10 :: (load 8 from %stack.15)
$x0 = ORRXrs $xzr, killed $x8, 0, debug-location !50
BL @objc_msgSend, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, implicit-def $x0, debug-location !50
renamable $x8 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_.2
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_.2, 0
renamable $x1 = ORRXri $xzr, 4097
renamable $x8 = LSRVXr killed renamable $x8, killed renamable $x1
$x1 = LDRXui $sp, 13 :: (load 8 from %stack.12)
renamable $w9 = LDRBBroX killed renamable $x8, killed renamable $x1, 0, 0, debug-location !51 :: (load 1 from %ir.40)
renamable $w9 = UBFMWri killed renamable $w9, 0, 7, debug-location !51
STRXui killed $x0, $sp, 9 :: (store 8 into %stack.16)
CBZW killed renamable $w9, %bb.6, debug-location !51
bb.5 (%ir-block.43):
successors:
$x0 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_.2, debug-location !51
renamable $x0 = ADDXri $x0, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_.2, 0, debug-location !51
BL @__asan_report_load8, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !51
INLINEASM &"", 1, debug-location !51
BRK 1, debug-location !51
bb.6 (%ir-block.44):
renamable $x8 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_.2
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_.2, 0
renamable $x1 = LDRXui killed renamable $x8, 0, debug-location !51 :: (invariant load 8 from @OBJC_SELECTOR_REFERENCES_.2)
$x8 = LDRXui $sp, 9 :: (load 8 from %stack.16)
$x9 = LDRXui $sp, 17 :: (load 8 from %stack.8)
renamable $x10 = UBFMXri renamable $x9, 3, 63, debug-location !51
$x11 = LDRXui $sp, 13 :: (load 8 from %stack.12)
renamable $w12 = LDRHHroX killed renamable $x10, killed renamable $x11, 0, 0, debug-location !51 :: (load 2 from %ir.51)
renamable $w12 = UBFMWri killed renamable $w12, 0, 15, debug-location !51
STRXui killed $x1, $sp, 8 :: (store 8 into %stack.17)
STRXui killed $x8, $sp, 7 :: (store 8 into %stack.18)
STRXui killed $x9, $sp, 6 :: (store 8 into %stack.19)
CBZW killed renamable $w12, %bb.8, debug-location !51
bb.7 (%ir-block.54):
successors:
$x0 = LDRXui $sp, 6 :: (load 8 from %stack.19)
BL @__asan_report_load16, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !51
INLINEASM &"", 1, debug-location !51
BRK 1, debug-location !51
bb.8 (%ir-block.55):
$x8 = LDRXui $sp, 6 :: (load 8 from %stack.19)
renamable $d1 = LDRDui renamable $x8, 1, debug-location !51 :: (load 8 from %ir.47 + 8)
renamable $d0 = LDRDui killed renamable $x8, 0, debug-location !51 :: (load 8 from %ir.47)
$x0 = LDRXui $sp, 7 :: (load 8 from %stack.18)
$x1 = LDRXui $sp, 8 :: (load 8 from %stack.17)
BL @objc_msgSend, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, implicit killed $d0, implicit killed $d1, implicit-def $sp, implicit-def $x0, debug-location !51
$x8 = LDRXui $sp, 16 :: (load 8 from %stack.9)
renamable $x1 = UBFMXri killed renamable $x8, 3, 63, debug-location !44
$lr = LDRXui $sp, 13 :: (load 8 from %stack.12)
renamable $w9 = LDRBBroX killed renamable $x1, killed renamable $lr, 0, 0, debug-location !44 :: (load 1 from %ir.61)
renamable $w9 = UBFMWri killed renamable $w9, 0, 7, debug-location !44
STRXui killed $x0, $sp, 5 :: (store 8 into %stack.20)
CBZW killed renamable $w9, %bb.10, debug-location !44
bb.9 (%ir-block.64):
successors:
$x0 = LDRXui $sp, 16 :: (load 8 from %stack.9)
BL @__asan_report_store8, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !44
INLINEASM &"", 1, debug-location !44
BRK 1, debug-location !44
bb.10 (%ir-block.65):
renamable $x8 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_.4
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_.4, 0
renamable $x9 = ORRXri $xzr, 4097
renamable $x8 = LSRVXr killed renamable $x8, killed renamable $x9
$x9 = LDRXui $sp, 5 :: (load 8 from %stack.20)
$x10 = LDRXui $sp, 16 :: (load 8 from %stack.9)
STRXui killed renamable $x9, renamable $x10, 0, debug-location !44 :: (store 8 into %ir.6)
renamable $x11 = LDRXui killed renamable $x10, 0, debug-location !52 :: (load 8 from %ir.6)
$x12 = LDRXui $sp, 13 :: (load 8 from %stack.12)
renamable $w13 = LDRBBroX killed renamable $x8, killed renamable $x12, 0, 0, debug-location !53 :: (load 1 from %ir.68)
renamable $w13 = UBFMWri killed renamable $w13, 0, 7, debug-location !53
STRXui killed $x11, $sp, 4 :: (store 8 into %stack.21)
CBZW killed renamable $w13, %bb.12, debug-location !53
bb.11 (%ir-block.71):
successors:
$x0 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_.4, debug-location !53
renamable $x0 = ADDXri $x0, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_.4, 0, debug-location !53
BL @__asan_report_load8, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !53
INLINEASM &"", 1, debug-location !53
BRK 1, debug-location !53
bb.12 (%ir-block.72):
renamable $x8 = ADRP target-flags(aarch64-page) @OBJC_SELECTOR_REFERENCES_.4
renamable $x8 = ADDXri killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @OBJC_SELECTOR_REFERENCES_.4, 0
renamable $x1 = LDRXui killed renamable $x8, 0, debug-location !53 :: (invariant load 8 from @OBJC_SELECTOR_REFERENCES_.4)
$x8 = LDRXui $sp, 4 :: (load 8 from %stack.21)
$x0 = ORRXrs $xzr, killed $x8, 0, debug-location !53
BL @objc_msgSend, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, implicit-def $x0, debug-location !53
INLINEASM &"mov\09fp, fp\09\09; marker for objc_retainAutoreleaseReturnValue", 1, debug-location !53
BL @objc_retainAutoreleasedReturnValue, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $x0, debug-location !53
$x8 = LDRXui $sp, 16 :: (load 8 from %stack.9)
STRXui killed $x0, $sp, 3 :: (store 8 into %stack.22)
$x0 = ORRXrs $xzr, killed $x8, 0, debug-location !54
$x8 = ORRXrs $xzr, killed $xzr, 0, debug-location !54
$x1 = ORRXrs $xzr, killed $x8, 0, debug-location !54
BL @objc_storeStrong, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, debug-location !54
$x0 = LDRXui $sp, 3 :: (load 8 from %stack.22)
BL @objc_autoreleaseReturnValue, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $x0, debug-location !54
$x8 = MOVZXi 13838, 0, debug-location !54
$x8 = MOVKXi $x8, 17888, 16, debug-location !54
$x1 = LDRXui $sp, 15 :: (load 8 from %stack.10)
STRXui killed renamable $x8, killed renamable $x1, 0, debug-location !54 :: (store 8 into %ir.7)
$x8 = LDRXui $sp, 12 :: (load 8 from %stack.13)
STRXui $xzr, renamable $x8, 0, debug-location !54 :: (store 8 into %ir.79, align 1)
STURHHi $wzr, renamable $x8, 9, debug-location !54 :: (store 2 into %ir.81, align 1)
STRBBui $wzr, killed renamable $x8, 11, debug-location !54 :: (store 1 into %ir.83)
$lr = ADRP target-flags(aarch64-page, aarch64-got) @__stack_chk_guard
$lr = LDRXui $lr, target-flags(aarch64-pageoff, aarch64-got, aarch64-nc) @__stack_chk_guard
$lr = LDRXui killed $lr, 0 :: (dereferenceable invariant load 8 from @__stack_chk_guard)
renamable $x9 = LDRXui $sp, 39 :: (load 8 from %stack.0.StackGuardSlot)
$xzr = SUBSXrs killed renamable $lr, killed renamable $x9, 0, implicit-def $nzcv, implicit-def $nzcv
STRXui killed $x0, $sp, 2 :: (store 8 into %stack.23)
Bcc 1, %bb.14, implicit $nzcv
bb.13.SP_return:
$x0 = LDRXui $sp, 2 :: (load 8 from %stack.23)
$sp = frame-destroy SUBXri $fp, 16, 0, debug-location !54
$fp, $lr = frame-destroy LDPXi $sp, 2, debug-location !54 :: (load 8 from %stack.25), (load 8 from %stack.24)
early-clobber $sp, $x28, $x27 = frame-destroy LDPXpost $sp, 4, debug-location !54 :: (load 8 from %stack.27), (load 8 from %stack.26)
RET undef $lr, implicit killed $x0, debug-location !54
bb.14.CallStackCheckFailBlk:
BL @__stack_chk_fail, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, debug-location !47
BRK 1, debug-location !47
...
---
name: asan.module_ctor
alignment: 2
tracksRegLiveness: true
frameInfo:
stackSize: 16
maxAlignment: 8
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
stack:
- { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$lr' }
- { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$fp' }
body: |
bb.0 (%ir-block.0):
liveins: $lr
early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -2 :: (store 8 into %stack.1), (store 8 into %stack.0)
frame-setup CFI_INSTRUCTION def_cfa_offset 16
frame-setup CFI_INSTRUCTION offset $w30, -8
frame-setup CFI_INSTRUCTION offset $w29, -16
BL @__asan_init, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp
BL @__asan_version_mismatch_check_v8, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp
early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2 :: (load 8 from %stack.1), (load 8 from %stack.0)
RET undef $lr
...

View File

@ -1,66 +0,0 @@
; RUN: llc -O0 -regalloc=fast -stop-after=livedebugvalues -o - < %s | \
; RUN: FileCheck %s -implicit-check-not=DBG_VALUE
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios12.1.0"
declare void @use(i32 %x)
define void @f1(i32 %x) !dbg !6 {
; CHECK-LABEL: name: f1
entry:
; CHECK-LABEL: bb.0.entry:
%var = add i32 %x, 1, !dbg !12
call void @llvm.dbg.value(metadata i32 %var, metadata !9, metadata !DIExpression()), !dbg !12
; CHECK: DBG_VALUE renamable $w0, $noreg, !9, !DIExpression(), debug-location !12
; CHECK-NEXT: STRWui killed $w0, $sp, 3 :: (store 4 into %stack.0)
; CHECK-NEXT: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
br label %artificial-bb-1, !dbg !13
artificial-bb-1: ; preds = %entry
; CHECK-LABEL: bb.1.artificial-bb-1:
; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
br label %artificial-bb-2
artificial-bb-2: ; preds = %artificial-bb-1
; CHECK-LABEL: bb.2.artificial-bb-2:
; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
%invisible = add i32 %var, 1
br label %return, !dbg !14
return: ; preds = %artificial-bb-2
; CHECK-LABEL: bb.3.return:
; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
call void @use(i32 %var)
ret void, !dbg !15
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
attributes #0 = { nounwind readnone speculatable }
!llvm.dbg.cu = !{!0}
!llvm.debugify = !{!3, !4}
!llvm.module.flags = !{!5}
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "compiler-gen-bbs-livedebugvalues.ll", directory: "/")
!2 = !{}
!3 = !{i32 6}
!4 = !{i32 2}
!5 = !{i32 2, !"Debug Info Version", i32 3}
!6 = distinct !DISubprogram(name: "f1", linkageName: "f1", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8)
!7 = !DISubroutineType(types: !2)
!8 = !{!9, !11}
!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 4, type: !10)
!12 = !DILocation(line: 1, column: 1, scope: !6)
!13 = !DILocation(line: 2, column: 1, scope: !6)
!14 = !DILocation(line: 0, column: 1, scope: !6)
!15 = !DILocation(line: 4, column: 1, scope: !6)

View File

@ -0,0 +1,110 @@
# RUN: llc -o - %s -O0 -regalloc=fast -run-pass=livedebugvalues | \
# RUN: FileCheck %s -implicit-check-not=DBG_VALUE
--- |
target triple = "arm64-apple-ios12.1.0"
declare void @use(i32)
define void @f1(i32 %x) !dbg !6 {
entry:
%var = add i32 %x, 1, !dbg !12
call void @llvm.dbg.value(metadata i32 %var, metadata !9, metadata !DIExpression()), !dbg !12
br label %artificial-bb-1, !dbg !13
artificial-bb-1:
br label %artificial-bb-2
artificial-bb-2:
%invisible = add i32 %var, 1
br label %return, !dbg !14
return:
call void @use(i32 %var)
ret void, !dbg !15
}
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
declare void @llvm.stackprotector(i8*, i8**) #1
attributes #0 = { nounwind readnone speculatable }
attributes #1 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.debugify = !{!3, !4}
!llvm.module.flags = !{!5}
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "compiler-gen-bbs-livedebugvalues.ll", directory: "/")
!2 = !{}
!3 = !{i32 6}
!4 = !{i32 2}
!5 = !{i32 2, !"Debug Info Version", i32 3}
!6 = distinct !DISubprogram(name: "f1", linkageName: "f1", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8)
!7 = !DISubroutineType(types: !2)
!8 = !{!9, !11}
!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 4, type: !10)
!12 = !DILocation(line: 1, column: 1, scope: !6)
!13 = !DILocation(line: 2, column: 1, scope: !6)
!14 = !DILocation(line: 0, column: 1, scope: !6)
!15 = !DILocation(line: 4, column: 1, scope: !6)
...
---
# CHECK-LABEL: name: f1
name: f1
alignment: 2
legalized: true
regBankSelected: true
selected: true
tracksRegLiveness: true
frameInfo:
stackSize: 32
maxAlignment: 8
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
stack:
- { id: 0, type: spill-slot, offset: -20, size: 4, alignment: 4, stack-id: 0 }
- { id: 1, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$lr' }
- { id: 2, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: 0,
callee-saved-register: '$fp' }
body: |
; CHECK-LABEL: bb.0.entry:
bb.0.entry:
liveins: $w0, $lr
$sp = frame-setup SUBXri $sp, 32, 0
frame-setup STPXi killed $fp, killed $lr, $sp, 2 :: (store 8 into %stack.2), (store 8 into %stack.1)
frame-setup CFI_INSTRUCTION def_cfa_offset 32
frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !12
frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !12
renamable $w0 = ADDWri killed renamable $w0, 1, 0, debug-location !12
DBG_VALUE renamable $w0, $noreg, !9, !DIExpression(), debug-location !12
STRWui killed $w0, $sp, 3 :: (store 4 into %stack.0)
DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12), debug-location !12
; CHECK: DBG_VALUE renamable $w0, $noreg, !9, !DIExpression(), debug-location !12
; CHECK-NEXT: STRWui killed $w0, $sp, 3 :: (store 4 into %stack.0)
; CHECK-NEXT: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
bb.1.artificial-bb-1:
; CHECK-LABEL: bb.1.artificial-bb-1:
; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
bb.2.artificial-bb-2:
; CHECK-LABEL: bb.2.artificial-bb-2:
; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
bb.3.return:
; CHECK-LABEL: bb.3.return:
; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
$w0 = LDRWui $sp, 3 :: (load 4 from %stack.0)
BL @use, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit killed $w0
$fp, $lr = frame-destroy LDPXi $sp, 2, debug-location !15 :: (load 8 from %stack.2), (load 8 from %stack.1)
$sp = frame-destroy ADDXri $sp, 32, 0, debug-location !15
RET undef $lr, debug-location !15
...

View File

@ -1,114 +0,0 @@
; struct A {
; A();
; virtual ~A();
; };
; struct B : A {
; B();
; virtual ~B();
; };
; B::B() {}
; CHECK: __ZN1BC1Ev:
; CHECK: .loc 1 [[@LINE-2]] 0 prologue_end
; CHECK-NOT: .loc 1 0 0 prologue_end
; The location of the prologue_end marker should not be affected by the presence
; of CFI instructions.
; RUN: llc -O0 -filetype=asm -mtriple=thumbv7-apple-ios < %s | FileCheck %s
; RUN: llc -O0 -filetype=asm -mtriple=thumbv6-apple-ios < %s | FileCheck %s
; ModuleID = 'test1.cpp'
target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
target triple = "thumbv7-apple-ios"
%struct.B = type { %struct.A }
%struct.A = type { i32 (...)** }
@_ZTV1B = external unnamed_addr constant [4 x i8*]
; Function Attrs: nounwind
define %struct.B* @_ZN1BC2Ev(%struct.B* %this) unnamed_addr #0 align 2 !dbg !28 {
entry:
tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !30, metadata !40), !dbg !41
%0 = getelementptr inbounds %struct.B, %struct.B* %this, i32 0, i32 0, !dbg !42
%call = tail call %struct.A* @_ZN1AC2Ev(%struct.A* %0) #3, !dbg !42
%1 = getelementptr inbounds %struct.B, %struct.B* %this, i32 0, i32 0, i32 0, !dbg !42
store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1B, i32 0, i32 2) to i32 (...)**), i32 (...)*** %1, align 4, !dbg !42, !tbaa !43
ret %struct.B* %this, !dbg !42
}
declare %struct.A* @_ZN1AC2Ev(%struct.A*)
; Function Attrs: nounwind
define %struct.B* @_ZN1BC1Ev(%struct.B* %this) unnamed_addr #0 align 2 !dbg !32 {
entry:
tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !34, metadata !40), !dbg !46
tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !47, metadata !40) #3, !dbg !49
%0 = getelementptr inbounds %struct.B, %struct.B* %this, i32 0, i32 0, !dbg !50
%call.i = tail call %struct.A* @_ZN1AC2Ev(%struct.A* %0) #3, !dbg !50
%1 = getelementptr inbounds %struct.B, %struct.B* %this, i32 0, i32 0, i32 0, !dbg !50
store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1B, i32 0, i32 2) to i32 (...)**), i32 (...)*** %1, align 4, !dbg !50, !tbaa !43
ret %struct.B* %this, !dbg !48
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
attributes #0 = { nounwind }
attributes #2 = { nounwind readnone }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!35, !36, !37, !38}
!llvm.ident = !{!39}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224279) (llvm/trunk 224283)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
!1 = !DIFile(filename: "<stdin>", directory: "")
!2 = !{}
!3 = !{!4, !13}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 5, size: 32, align: 32, file: !5, elements: !6, vtableHolder: !13, identifier: "_ZTS1B")
!5 = !DIFile(filename: "test1.cpp", directory: "")
!6 = !{!7, !8, !12}
!7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !4, baseType: !13)
!8 = !DISubprogram(name: "B", line: 6, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !5, scope: !4, type: !9)
!9 = !DISubroutineType(types: !10)
!10 = !{null, !11}
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
!12 = !DISubprogram(name: "~B", line: 7, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !5, scope: !4, type: !9, containingType: !4)
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 32, align: 32, file: !5, elements: !14, vtableHolder: !13, identifier: "_ZTS1A")
!14 = !{!15, !22, !26}
!15 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 32, flags: DIFlagArtificial, file: !5, scope: !16, baseType: !17)
!16 = !DIFile(filename: "test1.cpp", directory: "")
!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, baseType: !18)
!18 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", size: 32, baseType: !19)
!19 = !DISubroutineType(types: !20)
!20 = !{!21}
!21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!22 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !5, scope: !13, type: !23)
!23 = !DISubroutineType(types: !24)
!24 = !{null, !25}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !13)
!26 = !DISubprogram(name: "~A", line: 3, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !5, scope: !13, type: !23, containingType: !13)
!28 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !4, type: !9, declaration: !8, retainedNodes: !29)
!29 = !{!30}
!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!31 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !4)
!32 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", line: 9, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !5, scope: !4, type: !9, declaration: !8, retainedNodes: !33)
!33 = !{!34}
!34 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !32, type: !31)
!35 = !{i32 2, !"Dwarf Version", i32 4}
!36 = !{i32 2, !"Debug Info Version", i32 3}
!37 = !{i32 1, !"wchar_size", i32 4}
!38 = !{i32 1, !"min_enum_size", i32 4}
!39 = !{!"clang version 3.6.0 (trunk 224279) (llvm/trunk 224283)"}
!40 = !DIExpression()
!41 = !DILocation(line: 0, scope: !28)
!42 = !DILocation(line: 9, scope: !28)
!43 = !{!44, !44, i64 0}
!44 = !{!"vtable pointer", !45, i64 0}
!45 = !{!"Simple C/C++ TBAA"}
!46 = !DILocation(line: 0, scope: !32)
!47 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !31)
!48 = !DILocation(line: 9, scope: !32)
!49 = !DILocation(line: 0, scope: !28, inlinedAt: !48)
!50 = !DILocation(line: 9, scope: !28, inlinedAt: !48)

View File

@ -0,0 +1,212 @@
# RUN: llc -o - %s -mtriple=thumbv7-apple-ios -start-after=patchable-function | FileCheck %s
# RUN: llc -o - %s -mtriple=thumbv6-apple-ios -start-after=patchable-function | FileCheck %s
# struct A {
# A();
# virtual ~A();
# };
# struct B : A {
# B();
# virtual ~B();
# };
# B::B() {}
# CHECK: __ZN1BC1Ev:
# CHECK: .loc 1 9 0 prologue_end
# CHECK-NOT: .loc 1 0 0 prologue_end
#
# The location of the prologue_end marker should not be affected by the presence
# of CFI instructions.
--- |
%struct.B = type { %struct.A }
%struct.A = type { i32 (...)** }
@_ZTV1B = external unnamed_addr constant [4 x i8*]
; Function Attrs: nounwind
define %struct.B* @_ZN1BC2Ev(%struct.B* %this) unnamed_addr #0 align 2 !dbg !31 {
entry:
tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !33, metadata !DIExpression()), !dbg !35
%0 = bitcast %struct.B* %this to %struct.A*, !dbg !36
%call = tail call %struct.A* @_ZN1AC2Ev(%struct.A* %0) #0, !dbg !36
%1 = bitcast %struct.B* %this to i32 (...)***, !dbg !36
store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1B, i32 0, i32 2) to i32 (...)**), i32 (...)*** %1, align 4, !dbg !36, !tbaa !37
ret %struct.B* %this, !dbg !36
}
declare %struct.A* @_ZN1AC2Ev(%struct.A*)
; Function Attrs: nounwind
define %struct.B* @_ZN1BC1Ev(%struct.B* %this) unnamed_addr #0 align 2 !dbg !40 {
entry:
tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !42, metadata !DIExpression()), !dbg !43
tail call void @llvm.dbg.value(metadata %struct.B* %this, metadata !33, metadata !DIExpression()) #0, !dbg !44
%0 = bitcast %struct.B* %this to %struct.A*, !dbg !46
%call.i = tail call %struct.A* @_ZN1AC2Ev(%struct.A* %0) #0, !dbg !46
%1 = bitcast %struct.B* %this to i32 (...)***, !dbg !46
store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1B, i32 0, i32 2) to i32 (...)**), i32 (...)*** %1, align 4, !dbg !46, !tbaa !37
ret %struct.B* %this, !dbg !45
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
declare void @_Unwind_SjLj_Register({ i8*, i32, [4 x i32], i8*, i8*, [5 x i8*] }*)
declare void @_Unwind_SjLj_Unregister({ i8*, i32, [4 x i32], i8*, i8*, [5 x i8*] }*)
; Function Attrs: nounwind readnone
declare i8* @llvm.frameaddress(i32) #2
; Function Attrs: nounwind
declare i8* @llvm.stacksave() #0
; Function Attrs: nounwind
declare void @llvm.stackrestore(i8*) #0
; Function Attrs: nounwind
declare void @llvm.eh.sjlj.setup.dispatch() #0
; Function Attrs: nounwind readnone
declare i8* @llvm.eh.sjlj.lsda() #2
; Function Attrs: nounwind readnone
declare void @llvm.eh.sjlj.callsite(i32) #2
; Function Attrs: nounwind
declare void @llvm.eh.sjlj.functioncontext(i8*) #0
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #0
attributes #0 = { nounwind }
attributes #1 = { nounwind readnone speculatable }
attributes #2 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!26, !27, !28, !29}
!llvm.ident = !{!30}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.6.0 (trunk 224279) (llvm/trunk 224283)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
!1 = !DIFile(filename: "<stdin>", directory: "")
!2 = !{}
!3 = !{!4, !8}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !5, line: 5, size: 32, align: 32, elements: !6, vtableHolder: !8, identifier: "_ZTS1B")
!5 = !DIFile(filename: "test1.cpp", directory: "")
!6 = !{!7, !21, !25}
!7 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !4, baseType: !8)
!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !5, line: 1, size: 32, align: 32, elements: !9, vtableHolder: !8, identifier: "_ZTS1A")
!9 = !{!10, !16, !20}
!10 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", scope: !5, file: !5, baseType: !11, size: 32, flags: DIFlagArtificial)
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32)
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", baseType: !13, size: 32)
!13 = !DISubroutineType(types: !14)
!14 = !{!15}
!15 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!16 = !DISubprogram(name: "A", scope: !8, file: !5, line: 2, type: !17, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true)
!17 = !DISubroutineType(types: !18)
!18 = !{null, !19}
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer)
!20 = !DISubprogram(name: "~A", scope: !8, file: !5, line: 3, type: !17, isLocal: false, isDefinition: false, scopeLine: 3, containingType: !8, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: true)
!21 = !DISubprogram(name: "B", scope: !4, file: !5, line: 6, type: !22, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true)
!22 = !DISubroutineType(types: !23)
!23 = !{null, !24}
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer)
!25 = !DISubprogram(name: "~B", scope: !4, file: !5, line: 7, type: !22, isLocal: false, isDefinition: false, scopeLine: 7, containingType: !4, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: true)
!26 = !{i32 2, !"Dwarf Version", i32 4}
!27 = !{i32 2, !"Debug Info Version", i32 3}
!28 = !{i32 1, !"wchar_size", i32 4}
!29 = !{i32 1, !"min_enum_size", i32 4}
!30 = !{!"clang version 3.6.0 (trunk 224279) (llvm/trunk 224283)"}
!31 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC2Ev", scope: !4, file: !5, line: 9, type: !22, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !21, retainedNodes: !32)
!32 = !{!33}
!33 = !DILocalVariable(name: "this", arg: 1, scope: !31, type: !34, flags: DIFlagArtificial | DIFlagObjectPointer)
!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 32, align: 32)
!35 = !DILocation(line: 0, scope: !31)
!36 = !DILocation(line: 9, scope: !31)
!37 = !{!38, !38, i64 0}
!38 = !{!"vtable pointer", !39, i64 0}
!39 = !{!"Simple C/C++ TBAA"}
!40 = distinct !DISubprogram(name: "B", linkageName: "_ZN1BC1Ev", scope: !4, file: !5, line: 9, type: !22, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !21, retainedNodes: !41)
!41 = !{!42}
!42 = !DILocalVariable(name: "this", arg: 1, scope: !40, type: !34, flags: DIFlagArtificial | DIFlagObjectPointer)
!43 = !DILocation(line: 0, scope: !40)
!44 = !DILocation(line: 0, scope: !31, inlinedAt: !45)
!45 = !DILocation(line: 9, scope: !40)
!46 = !DILocation(line: 9, scope: !31, inlinedAt: !45)
...
---
name: _ZN1BC2Ev
alignment: 1
liveins:
- { reg: '$r0' }
frameInfo:
stackSize: 8
maxAlignment: 4
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
stack:
- { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, stack-id: 0,
callee-saved-register: '$lr', callee-saved-restored: false }
- { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: 0,
callee-saved-register: '$r4' }
body: |
bb.0.entry:
frame-setup tPUSH 14, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp
frame-setup CFI_INSTRUCTION def_cfa_offset 8
frame-setup CFI_INSTRUCTION offset $lr, -4
frame-setup CFI_INSTRUCTION offset $r4, -8
DBG_VALUE debug-use $r0, debug-use $noreg, !33, !DIExpression(), debug-location !35
$r4 = tMOVr $r0, 14, $noreg
DBG_VALUE debug-use $r4, debug-use $noreg, !33, !DIExpression(), debug-location !35
tBL 14, $noreg, @_ZN1AC2Ev, csr_ios, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0, debug-location !36
$r0 = t2MOVi16_ga_pcrel target-flags(arm-lo16, arm-nonlazy) @_ZTV1B, 0, debug-location !36
$r0 = t2MOVTi16_ga_pcrel killed $r0, target-flags(arm-hi16, arm-nonlazy) @_ZTV1B, 0, debug-location !36
$r0 = tPICADD killed $r0, 0, debug-location !36
renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg, debug-location !36 :: (load 4 from got)
renamable $r0, dead $cpsr = nuw tADDi8 killed renamable $r0, 8, 14, $noreg, debug-location !36
tSTRi killed renamable $r0, renamable $r4, 0, 14, $noreg, debug-location !36 :: (store 4 into %ir.1, !tbaa !37)
$r0 = tMOVr killed $r4, 14, $noreg, debug-location !36
tPOP_RET 14, $noreg, def $r4, def $pc, implicit killed $r0, debug-location !36
...
---
name: _ZN1BC1Ev
alignment: 1
liveins:
- { reg: '$r0' }
frameInfo:
stackSize: 8
maxAlignment: 4
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
stack:
- { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, stack-id: 0,
callee-saved-register: '$lr', callee-saved-restored: false }
- { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: 0,
callee-saved-register: '$r4' }
body: |
bb.0.entry:
frame-setup tPUSH 14, $noreg, killed $r4, killed $lr, implicit-def $sp, implicit $sp
frame-setup CFI_INSTRUCTION def_cfa_offset 8
frame-setup CFI_INSTRUCTION offset $lr, -4
frame-setup CFI_INSTRUCTION offset $r4, -8
DBG_VALUE debug-use $r0, debug-use $noreg, !42, !DIExpression(), debug-location !43
DBG_VALUE debug-use $r0, debug-use $noreg, !33, !DIExpression(), debug-location !44
$r4 = tMOVr $r0, 14, $noreg
DBG_VALUE debug-use $r4, debug-use $noreg, !33, !DIExpression(), debug-location !44
DBG_VALUE debug-use $r4, debug-use $noreg, !42, !DIExpression(), debug-location !43
tBL 14, $noreg, @_ZN1AC2Ev, csr_ios, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0, debug-location !46
$r0 = t2MOVi16_ga_pcrel target-flags(arm-lo16, arm-nonlazy) @_ZTV1B, 0, debug-location !46
$r0 = t2MOVTi16_ga_pcrel killed $r0, target-flags(arm-hi16, arm-nonlazy) @_ZTV1B, 0, debug-location !46
$r0 = tPICADD killed $r0, 0, debug-location !46
renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg, debug-location !46 :: (load 4 from got)
renamable $r0, dead $cpsr = nuw tADDi8 killed renamable $r0, 8, 14, $noreg, debug-location !46
tSTRi killed renamable $r0, renamable $r4, 0, 14, $noreg, debug-location !46 :: (store 4 into %ir.1, !tbaa !37)
$r0 = tMOVr killed $r4, 14, $noreg, debug-location !45
tPOP_RET 14, $noreg, def $r4, def $pc, implicit killed $r0, debug-location !45
...

View File

@ -1,190 +0,0 @@
; RUN: llc -fast-isel-sink-local-values -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
; RUN: llc -fast-isel-sink-local-values -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj < %s \
; RUN: | llvm-dwarfdump -debug-info - | FileCheck %s --check-prefix=DWARF
; Verify that we have correct debug info for local variables in code
; instrumented with AddressSanitizer.
; Generated from the source file test.cc:
; int bar(int y) {
; return y + 2;
; }
; with "clang++ -S -emit-llvm -mllvm -asan-skip-promotable-allocas=0 -fsanitize=address -O0 -g test.cc"
; The address of the (potentially now malloc'ed) alloca ends up
; in rdi, after which it is spilled to the stack. We record the
; spill OFFSET on the stack for checking the debug info below.
; CHECK: #DEBUG_VALUE: bar:y <- [DW_OP_deref] [$rcx+0]
; CHECK: movq %rcx, [[OFFSET:[0-9]+]](%rsp)
; CHECK-NEXT: [[START_LABEL:.Ltmp[0-9]+]]
; CHECK-NEXT: #DEBUG_VALUE: bar:y <- [DW_OP_plus_uconst [[OFFSET]], DW_OP_deref, DW_OP_deref]
; This location should be valid until the end of the function.
; CHECK: movq %rbp, %rsp
; CHECK-NEXT: [[END_LABEL:.Ltmp[0-9]+]]:
; CHECK: .Ldebug_loc{{[0-9]+}}:
; We expect two location ranges for the variable.
; First, its address is stored in %rcx:
; CHECK: .quad .Lfunc_begin0-.Lfunc_begin0
; CHECK-NEXT: .quad [[START_LABEL]]-.Lfunc_begin0
; CHECK: DW_OP_breg2
; DWARF: DW_TAG_formal_parameter
; DWARF: DW_AT_location
; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg2 RCX+0, DW_OP_deref
; Then it's addressed via %rsp:
; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
; CHECK-NEXT: .quad [[END_LABEL]]-.Lfunc_begin0
; CHECK: DW_OP_breg7
; CHECK-NEXT: [[OFFSET]]
; CHECK: DW_OP_deref
; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_deref, DW_OP_deref)
; ModuleID = 'test.cc'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }]
@__asan_option_detect_stack_use_after_return = external global i32
@___asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 6 y.addr\00", align 1
; Function Attrs: nounwind sanitize_address uwtable
define i32 @_Z3bari(i32 %y) #0 !dbg !4 {
entry:
%MyAlloca = alloca [64 x i8], align 32
%0 = ptrtoint [64 x i8]* %MyAlloca to i64
%1 = load i32, i32* @__asan_option_detect_stack_use_after_return
%2 = icmp ne i32 %1, 0
br i1 %2, label %3, label %5
; <label>:3 ; preds = %entry
%4 = call i64 @__asan_stack_malloc_0(i64 64, i64 %0)
br label %5
; <label>:5 ; preds = %entry, %3
%6 = phi i64 [ %0, %entry ], [ %4, %3 ]
%7 = add i64 %6, 32
%8 = inttoptr i64 %7 to i32*
%9 = inttoptr i64 %6 to i64*
store i64 1102416563, i64* %9
%10 = add i64 %6, 8
%11 = inttoptr i64 %10 to i64*
store i64 ptrtoint ([16 x i8]* @___asan_gen_ to i64), i64* %11
%12 = add i64 %6, 16
%13 = inttoptr i64 %12 to i64*
store i64 ptrtoint (i32 (i32)* @_Z3bari to i64), i64* %13
%14 = lshr i64 %6, 3
%15 = add i64 %14, 2147450880
%16 = add i64 %15, 0
%17 = inttoptr i64 %16 to i64*
store i64 -868083100587789839, i64* %17
%18 = ptrtoint i32* %8 to i64
%19 = lshr i64 %18, 3
%20 = add i64 %19, 2147450880
%21 = inttoptr i64 %20 to i8*
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
call void @llvm.dbg.declare(metadata i32* %8, metadata !12, metadata !14), !dbg !DILocation(scope: !4)
br i1 %23, label %24, label %30
; <label>:24 ; preds = %5
%25 = and i64 %18, 7
%26 = add i64 %25, 3
%27 = trunc i64 %26 to i8
%28 = icmp sge i8 %27, %22
br i1 %28, label %29, label %30
; <label>:29 ; preds = %24
call void @__asan_report_store4(i64 %18)
call void asm sideeffect "", ""()
unreachable
; <label>:30 ; preds = %24, %5
store i32 %y, i32* %8, align 4
%31 = ptrtoint i32* %8 to i64, !dbg !13
%32 = lshr i64 %31, 3, !dbg !13
%33 = add i64 %32, 2147450880, !dbg !13
%34 = inttoptr i64 %33 to i8*, !dbg !13
%35 = load i8, i8* %34, !dbg !13
%36 = icmp ne i8 %35, 0, !dbg !13
br i1 %36, label %37, label %43, !dbg !13
; <label>:37 ; preds = %30
%38 = and i64 %31, 7, !dbg !13
%39 = add i64 %38, 3, !dbg !13
%40 = trunc i64 %39 to i8, !dbg !13
%41 = icmp sge i8 %40, %35, !dbg !13
br i1 %41, label %42, label %43
; <label>:42 ; preds = %37
call void @__asan_report_load4(i64 %31), !dbg !13
call void asm sideeffect "", ""()
unreachable
; <label>:43 ; preds = %37, %30
%44 = load i32, i32* %8, align 4, !dbg !13
%add = add nsw i32 %44, 2, !dbg !13
store i64 1172321806, i64* %9, !dbg !13
%45 = icmp ne i64 %6, %0, !dbg !13
br i1 %45, label %46, label %53, !dbg !13
; <label>:46 ; preds = %43
%47 = add i64 %15, 0, !dbg !13
%48 = inttoptr i64 %47 to i64*, !dbg !13
store i64 -723401728380766731, i64* %48, !dbg !13
%49 = add i64 %6, 56, !dbg !13
%50 = inttoptr i64 %49 to i64*, !dbg !13
%51 = load i64, i64* %50, !dbg !13
%52 = inttoptr i64 %51 to i8*, !dbg !13
store i8 0, i8* %52, !dbg !13
br label %56, !dbg !13
; <label>:53 ; preds = %43
%54 = add i64 %15, 0, !dbg !13
%55 = inttoptr i64 %54 to i64*, !dbg !13
store i64 0, i64* %55, !dbg !13
br label %56, !dbg !13
; <label>:56 ; preds = %53, %46
ret i32 %add, !dbg !13
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
define internal void @asan.module_ctor() {
call void @__asan_init_v3()
ret void
}
declare void @__asan_init_v3()
declare void @__asan_report_load4(i64)
declare void @__asan_report_store4(i64)
declare i64 @__asan_stack_malloc_0(i64, i64)
attributes #0 = { nounwind sanitize_address 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" }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!9, !10}
!llvm.ident = !{!11}
!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: !2, globals: !2, imports: !2)
!1 = !DIFile(filename: "test.cc", directory: "/llvm_cmake_gcc")
!2 = !{}
!4 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
!5 = !DIFile(filename: "test.cc", directory: "/llvm_cmake_gcc")
!6 = !DISubroutineType(types: !7)
!7 = !{!8, !8}
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!9 = !{i32 2, !"Dwarf Version", i32 4}
!10 = !{i32 2, !"Debug Info Version", i32 3}
!11 = !{!"clang version 3.5.0 (209308)"}
!12 = !DILocalVariable(name: "y", line: 1, arg: 1, scope: !4, file: !5, type: !8)
!13 = !DILocation(line: 2, scope: !4)
!14 = !DIExpression(DW_OP_deref)

View File

@ -0,0 +1,346 @@
# RUN: llc -o - %s -start-after=patchable-function -O0 -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
# RUN: llc -o - %s -start-after=patchable-function -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj \
# RUN: | llvm-dwarfdump -debug-info - | FileCheck %s --check-prefix=DWARF
#
# Verify that we have correct debug info for local variables in code
# instrumented with AddressSanitizer.
#
# Generated from the source file test.cc:
# int bar(int y) {
# return y + 2;
# }
# with "clang++ -S -emit-llvm -mllvm -asan-skip-promotable-allocas=0 -fsanitize=address -O0 -g test.cc"
#
# The address of the (potentially now malloc'ed) alloca ends up
# in rdi, after which it is spilled to the stack. We record the
# spill OFFSET on the stack for checking the debug info below.
# CHECK: #DEBUG_VALUE: bar:y <- [DW_OP_deref] [$rcx+0]
# CHECK: movq %rcx, [[OFFSET:[0-9]+]](%rsp)
# CHECK-NEXT: [[START_LABEL:.Ltmp[0-9]+]]
# CHECK-NEXT: #DEBUG_VALUE: bar:y <- [DW_OP_plus_uconst [[OFFSET]], DW_OP_deref, DW_OP_deref]
# This location should be valid until the end of the function.
#
# CHECK: movq %rbp, %rsp
# CHECK-NEXT: [[END_LABEL:.Ltmp[0-9]+]]:
#
# CHECK: .Ldebug_loc{{[0-9]+}}:
# We expect two location ranges for the variable.
#
# First, its address is stored in %rcx:
# CHECK: .quad .Lfunc_begin0-.Lfunc_begin0
# CHECK-NEXT: .quad [[START_LABEL]]-.Lfunc_begin0
# CHECK: DW_OP_breg2
# DWARF: DW_TAG_formal_parameter
# DWARF: DW_AT_location
# DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg2 RCX+0, DW_OP_deref
#
# Then it's addressed via %rsp:
# CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
# CHECK-NEXT: .quad [[END_LABEL]]-.Lfunc_begin0
# CHECK: DW_OP_breg7
# CHECK-NEXT: [[OFFSET]]
# CHECK: DW_OP_deref
# DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_deref, DW_OP_deref)
--- |
@__asan_option_detect_stack_use_after_return = external global i32
@___asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 6 y.addr\00", align 1
; Function Attrs: nounwind sanitize_address uwtable
define i32 @_Z3bari(i32 %y) #0 !dbg !6 {
entry:
%MyAlloca = alloca [64 x i8], align 32
%0 = ptrtoint [64 x i8]* %MyAlloca to i64
%1 = load i32, i32* @__asan_option_detect_stack_use_after_return
%2 = icmp ne i32 %1, 0
br i1 %2, label %3, label %5
; <label>:3: ; preds = %entry
%4 = call i64 @__asan_stack_malloc_0(i64 64, i64 %0)
br label %5
; <label>:5: ; preds = %3, %entry
%6 = phi i64 [ %0, %entry ], [ %4, %3 ]
%7 = add i64 %6, 32
%8 = inttoptr i64 %7 to i32*
%9 = inttoptr i64 %6 to i64*
store i64 1102416563, i64* %9
%10 = add i64 %6, 8
%11 = inttoptr i64 %10 to i64*
store i64 ptrtoint ([16 x i8]* @___asan_gen_ to i64), i64* %11
%12 = add i64 %6, 16
%13 = inttoptr i64 %12 to i64*
store i64 ptrtoint (i32 (i32)* @_Z3bari to i64), i64* %13
%14 = lshr i64 %6, 3
%15 = add i64 %14, 2147450880
%16 = add i64 %15, 0
%17 = inttoptr i64 %16 to i64*
store i64 -868083100587789839, i64* %17
%18 = ptrtoint i32* %8 to i64
%19 = lshr i64 %18, 3
%20 = add i64 %19, 2147450880
%21 = inttoptr i64 %20 to i8*
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
call void @llvm.dbg.declare(metadata i32* %8, metadata !10, metadata !DIExpression(DW_OP_deref)), !dbg !11
br i1 %23, label %24, label %30
; <label>:24: ; preds = %5
%25 = and i64 %18, 7
%26 = add i64 %25, 3
%27 = trunc i64 %26 to i8
%28 = icmp sge i8 %27, %22
br i1 %28, label %29, label %30
; <label>:29: ; preds = %24
call void @__asan_report_store4(i64 %18)
call void asm sideeffect "", ""()
unreachable
; <label>:30: ; preds = %24, %5
store i32 %y, i32* %8, align 4
%31 = ptrtoint i32* %8 to i64, !dbg !12
%32 = lshr i64 %31, 3, !dbg !12
%33 = add i64 %32, 2147450880, !dbg !12
%34 = inttoptr i64 %33 to i8*, !dbg !12
%35 = load i8, i8* %34, !dbg !12
%36 = icmp ne i8 %35, 0, !dbg !12
br i1 %36, label %37, label %43, !dbg !12
; <label>:37: ; preds = %30
%38 = and i64 %31, 7, !dbg !12
%39 = add i64 %38, 3, !dbg !12
%40 = trunc i64 %39 to i8, !dbg !12
%41 = icmp sge i8 %40, %35, !dbg !12
br i1 %41, label %42, label %43
; <label>:42: ; preds = %37
call void @__asan_report_load4(i64 %31), !dbg !12
call void asm sideeffect "", ""()
unreachable
; <label>:43: ; preds = %37, %30
%44 = load i32, i32* %8, align 4, !dbg !12
%add = add nsw i32 %44, 2, !dbg !12
store i64 1172321806, i64* %9, !dbg !12
%45 = icmp ne i64 %6, %0, !dbg !12
br i1 %45, label %46, label %53, !dbg !12
; <label>:46: ; preds = %43
%47 = add i64 %15, 0, !dbg !12
%48 = inttoptr i64 %47 to i64*, !dbg !12
store i64 -723401728380766731, i64* %48, !dbg !12
%49 = add i64 %6, 56, !dbg !12
%50 = inttoptr i64 %49 to i64*, !dbg !12
%51 = load i64, i64* %50, !dbg !12
%52 = inttoptr i64 %51 to i8*, !dbg !12
store i8 0, i8* %52, !dbg !12
br label %56, !dbg !12
; <label>:53: ; preds = %43
%54 = add i64 %15, 0, !dbg !12
%55 = inttoptr i64 %54 to i64*, !dbg !12
store i64 0, i64* %55, !dbg !12
br label %56, !dbg !12
; <label>:56: ; preds = %53, %46
ret i32 %add, !dbg !12
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare void @__asan_init_v3()
declare void @__asan_report_load4(i64)
declare void @__asan_report_store4(i64)
declare i64 @__asan_stack_malloc_0(i64, i64)
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #2
attributes #0 = { nounwind sanitize_address 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" }
attributes #1 = { nounwind readnone speculatable }
attributes #2 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!llvm.ident = !{!5}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.5.0 (209308)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
!1 = !DIFile(filename: "test.cc", directory: "/llvm_cmake_gcc")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{!"clang version 3.5.0 (209308)"}
!6 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!7 = !DISubroutineType(types: !8)
!8 = !{!9, !9}
!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!10 = !DILocalVariable(name: "y", arg: 1, scope: !6, file: !1, line: 1, type: !9)
!11 = !DILocation(line: 0, scope: !6)
!12 = !DILocation(line: 2, scope: !6)
...
---
name: _Z3bari
alignment: 4
tracksRegLiveness: true
liveins:
- { reg: '$edi' }
frameInfo:
stackSize: 152
offsetAdjustment: -160
maxAlignment: 32
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
fixedStack:
- { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: 0 }
stack:
- { id: 0, name: MyAlloca, offset: -96, size: 64, alignment: 32, stack-id: 0 }
- { id: 1, type: spill-slot, offset: -100, size: 4, alignment: 4, stack-id: 0 }
- { id: 2, type: spill-slot, offset: -112, size: 8, alignment: 8, stack-id: 0 }
- { id: 3, type: spill-slot, offset: -120, size: 8, alignment: 8, stack-id: 0 }
- { id: 4, type: spill-slot, offset: -128, size: 8, alignment: 8, stack-id: 0 }
- { id: 5, type: spill-slot, offset: -136, size: 8, alignment: 8, stack-id: 0 }
- { id: 6, type: spill-slot, offset: -144, size: 8, alignment: 8, stack-id: 0 }
- { id: 7, type: spill-slot, offset: -145, size: 1, alignment: 1, stack-id: 0 }
- { id: 8, type: spill-slot, offset: -146, size: 1, alignment: 1, stack-id: 0 }
- { id: 9, type: spill-slot, offset: -152, size: 4, alignment: 4, stack-id: 0 }
body: |
bb.0.entry:
liveins: $edi
frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 16
CFI_INSTRUCTION offset $rbp, -16
$rbp = frame-setup MOV64rr $rsp
CFI_INSTRUCTION def_cfa_register $rbp
$rsp = frame-setup AND64ri8 $rsp, -32, implicit-def dead $eflags
$rsp = frame-setup SUB64ri32 $rsp, 160, implicit-def dead $eflags
renamable $rax = LEA64r $rsp, 1, $noreg, 64, $noreg
CMP32mi8 $noreg, 1, $noreg, @__asan_option_detect_stack_use_after_return, $noreg, 0, implicit-def $eflags :: (load 4 from @__asan_option_detect_stack_use_after_return)
$rcx = MOV64rr $rax
MOV32mr $rsp, 1, $noreg, 60, $noreg, killed $edi :: (store 4 into %stack.1)
MOV64mr $rsp, 1, $noreg, 48, $noreg, killed $rax :: (store 8 into %stack.2)
MOV64mr $rsp, 1, $noreg, 40, $noreg, killed $rcx :: (store 8 into %stack.3)
JE_1 %bb.2, implicit $eflags
bb.1 (%ir-block.3):
$edi = MOV32ri 64, implicit-def $rdi
$rsi = MOV64rm $rsp, 1, $noreg, 48, $noreg :: (load 8 from %stack.2)
CALL64pcrel32 @__asan_stack_malloc_0, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit-def $rax
MOV64mr $rsp, 1, $noreg, 40, $noreg, killed $rax :: (store 8 into %stack.3)
bb.2 (%ir-block.5):
$rax = MOV64rm $rsp, 1, $noreg, 40, $noreg :: (load 8 from %stack.3)
$rcx = MOV64rr $rax
renamable $rcx = ADD64ri8 renamable $rcx, 32, implicit-def $eflags
MOV64mi32 renamable $rax, 1, $noreg, 0, $noreg, 1102416563 :: (store 8 into %ir.9)
renamable $rdx = MOV64ri @___asan_gen_
MOV64mr renamable $rax, 1, $noreg, 8, $noreg, killed renamable $rdx :: (store 8 into %ir.11)
renamable $rdx = MOV64ri @_Z3bari
MOV64mr renamable $rax, 1, $noreg, 16, $noreg, killed renamable $rdx :: (store 8 into %ir.13)
$rdx = MOV64rr $rax
renamable $rdx = SHR64ri renamable $rdx, 3, implicit-def $eflags
$rsi = MOV64rr $rdx
renamable $rsi = ADD64ri32 renamable $rsi, 2147450880, implicit-def $eflags
renamable $rdi = MOV64ri -868083100587789839
MOV64mr killed renamable $rdx, 1, $noreg, 2147450880, $noreg, killed renamable $rdi :: (store 8 into %ir.17)
$rdx = MOV64rr $rcx
renamable $rdx = SHR64ri renamable $rdx, 3, implicit-def $eflags
renamable $r8b = MOV8rm killed renamable $rdx, 1, $noreg, 2147450880, $noreg :: (load 1 from %ir.21)
DBG_VALUE renamable $rcx, 0, !10, !DIExpression(DW_OP_deref), debug-location !11
CMP8ri renamable $r8b, 0, implicit-def $eflags
MOV64mr $rsp, 1, $noreg, 32, $noreg, killed $rax :: (store 8 into %stack.4)
MOV64mr $rsp, 1, $noreg, 24, $noreg, killed $rcx :: (store 8 into %stack.5)
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
MOV64mr $rsp, 1, $noreg, 16, $noreg, killed $rsi :: (store 8 into %stack.6)
MOV8mr $rsp, 1, $noreg, 15, $noreg, killed $r8b :: (store 1 into %stack.7)
JE_1 %bb.5, implicit $eflags
bb.3 (%ir-block.24):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rax = MOV64rm $rsp, 1, $noreg, 24, $noreg :: (load 8 from %stack.5)
renamable $rax = AND64ri8 renamable $rax, 7, implicit-def $eflags
renamable $rax = ADD64ri8 renamable $rax, 3, implicit-def $eflags
$cl = MOV8rr $al, implicit killed $rax
$dl = MOV8rm $rsp, 1, $noreg, 15, $noreg :: (load 1 from %stack.7)
CMP8rr killed renamable $cl, killed renamable $dl, implicit-def $eflags
JL_1 %bb.5, implicit $eflags
bb.4 (%ir-block.29):
successors:
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rdi = MOV64rm $rsp, 1, $noreg, 24, $noreg :: (load 8 from %stack.5)
CALL64pcrel32 @__asan_report_store4, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi
INLINEASM &"", 1
bb.5 (%ir-block.30):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rax = MOV64rm $rsp, 1, $noreg, 24, $noreg :: (load 8 from %stack.5)
$ecx = MOV32rm $rsp, 1, $noreg, 60, $noreg :: (load 4 from %stack.1)
MOV32mr renamable $rax, 1, $noreg, 0, $noreg, killed renamable $ecx :: (store 4 into %ir.8)
renamable $rax = SHR64ri renamable $rax, 3, implicit-def $eflags, debug-location !12
renamable $dl = MOV8rm killed renamable $rax, 1, $noreg, 2147450880, $noreg, debug-location !12 :: (load 1 from %ir.34)
CMP8ri renamable $dl, 0, implicit-def $eflags, debug-location !12
MOV8mr $rsp, 1, $noreg, 14, $noreg, killed $dl :: (store 1 into %stack.8)
JE_1 %bb.8, implicit $eflags, debug-location !12
bb.6 (%ir-block.37):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rax = MOV64rm $rsp, 1, $noreg, 24, $noreg :: (load 8 from %stack.5)
renamable $rax = AND64ri8 renamable $rax, 7, implicit-def $eflags, debug-location !12
renamable $rax = ADD64ri8 renamable $rax, 3, implicit-def $eflags, debug-location !12
$cl = MOV8rr $al, implicit killed $rax, debug-location !12
$dl = MOV8rm $rsp, 1, $noreg, 14, $noreg :: (load 1 from %stack.8)
CMP8rr killed renamable $cl, killed renamable $dl, implicit-def $eflags, debug-location !12
JL_1 %bb.8, implicit $eflags
bb.7 (%ir-block.42):
successors:
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rdi = MOV64rm $rsp, 1, $noreg, 24, $noreg :: (load 8 from %stack.5)
CALL64pcrel32 @__asan_report_load4, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, debug-location !12
INLINEASM &"", 1
bb.8 (%ir-block.43):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rax = MOV64rm $rsp, 1, $noreg, 24, $noreg :: (load 8 from %stack.5)
renamable $ecx = MOV32rm killed renamable $rax, 1, $noreg, 0, $noreg, debug-location !12 :: (load 4 from %ir.8)
renamable $ecx = ADD32ri8 renamable $ecx, 2, implicit-def $eflags, debug-location !12
$rdx = MOV64rm $rsp, 1, $noreg, 32, $noreg :: (load 8 from %stack.4)
MOV64mi32 renamable $rdx, 1, $noreg, 0, $noreg, 1172321806, debug-location !12 :: (store 8 into %ir.9)
$rsi = MOV64rm $rsp, 1, $noreg, 48, $noreg :: (load 8 from %stack.2)
CMP64rr killed renamable $rdx, killed renamable $rsi, implicit-def $eflags, debug-location !12
MOV32mr $rsp, 1, $noreg, 8, $noreg, killed $ecx :: (store 4 into %stack.9)
JE_1 %bb.10, implicit $eflags, debug-location !12
bb.9 (%ir-block.46):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
renamable $rax = MOV64ri -723401728380766731, debug-location !12
$rcx = MOV64rm $rsp, 1, $noreg, 16, $noreg :: (load 8 from %stack.6)
MOV64mr killed renamable $rcx, 1, $noreg, 0, $noreg, killed renamable $rax, debug-location !12 :: (store 8 into %ir.48)
$rax = MOV64rm $rsp, 1, $noreg, 32, $noreg :: (load 8 from %stack.4)
renamable $rdx = MOV64rm killed renamable $rax, 1, $noreg, 56, $noreg, debug-location !12 :: (load 8 from %ir.50)
MOV8mi killed renamable $rdx, 1, $noreg, 0, $noreg, 0, debug-location !12 :: (store 1 into %ir.52)
JMP_1 %bb.11, debug-location !12
bb.10 (%ir-block.53):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$rax = MOV64rm $rsp, 1, $noreg, 16, $noreg :: (load 8 from %stack.6)
MOV64mi32 killed renamable $rax, 1, $noreg, 0, $noreg, 0, debug-location !12 :: (store 8 into %ir.55)
bb.11 (%ir-block.56):
DBG_VALUE $rsp, 0, !10, !DIExpression(DW_OP_plus_uconst, 24, DW_OP_deref, DW_OP_deref), debug-location !11
$eax = MOV32rm $rsp, 1, $noreg, 8, $noreg :: (load 4 from %stack.9)
$rsp = MOV64rr $rbp, debug-location !12
$rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !12
CFI_INSTRUCTION def_cfa $rsp, 8, debug-location !12
RETQ implicit killed $eax, debug-location !12
...

View File

@ -1,171 +0,0 @@
; RUN: llc %s -filetype=obj -O0 -mtriple=i386-unknown-linux-gnu -dwarf-version=4 -o %t
; RUN: llvm-dwarfdump -v %t | FileCheck %s
; From the code:
; debug-loc-offset1.cc
; int bar (int b) {
; return b+4;
; }
; debug-loc-offset2.cc
; struct A {
; int var;
; virtual char foo();
; };
; void baz(struct A a) {
; int z = 2;
; if (a.var > 2)
; z++;
; if (a.foo() == 'a')
; z++;
; }
; Compiled separately for i386-pc-linux-gnu and linked together.
; This ensures that we have multiple compile units and multiple location lists
; so that we can verify that
; debug_loc entries are relative to the low_pc of the CU. The loc entry for
; the byval argument in foo.cpp is in the second CU and so should have
; an offset relative to that CU rather than from the beginning of the text
; section.
; Checking that we have two compile units with two sets of high/lo_pc.
; CHECK: .debug_info contents
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_low_pc {{.*}} (0x0000000000000020)
; CHECK: DW_AT_high_pc
; CHECK: DW_TAG_subprogram
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A"
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_TAG_formal_parameter
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK-NEXT: [0x00000020, 0x00000037): DW_OP_breg0 EAX+0, DW_OP_deref
; CHECK-NEXT: [0x00000037, 0x00000063): DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"a"
; CHECK: DW_TAG_variable
; CHECK: DW_AT_location [DW_FORM_exprloc]
; CHECK-NOT: DW_AT_location
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_low_pc {{.*}} (0x0000000000000000)
; CHECK: DW_AT_high_pc
; CHECK: DW_TAG_subprogram
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3bari"
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_TAG_formal_parameter
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK-NEXT: [0x00000000, 0x0000000a): DW_OP_consts +0, DW_OP_stack_value
; CHECK-NEXT: [0x0000000a, 0x00000017): DW_OP_consts +1, DW_OP_stack_value)
; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"b"
; CHECK: .debug_loc contents:
; CHECK: 0x00000000:
; CHECK-NEXT: [0x00000000, 0x0000000a): DW_OP_consts +0, DW_OP_stack_value
; CHECK-NEXT: [0x0000000a, 0x00000017): DW_OP_consts +1, DW_OP_stack_value
; CHECK: 0x00000022:
; CHECK-NEXT: [0x00000000, 0x00000017): DW_OP_breg0 EAX+0, DW_OP_deref
; CHECK-NEXT: [0x00000017, 0x00000043): DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
%struct.A = type { i32 (...)**, i32 }
; Function Attrs: nounwind
define i32 @_Z3bari(i32 %b) #0 !dbg !4 {
entry:
%b.addr = alloca i32, align 4
store i32 %b, i32* %b.addr, align 4
call void @llvm.dbg.value(metadata i32 0, metadata !21, metadata !DIExpression()), !dbg !22
%0 = load i32, i32* %b.addr, align 4, !dbg !23
call void @llvm.dbg.value(metadata i32 1, metadata !21, metadata !DIExpression()), !dbg !22
%add = add nsw i32 %0, 4, !dbg !23
ret i32 %add, !dbg !23
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
define void @_Z3baz1A(%struct.A* %a) #2 !dbg !14 {
entry:
%z = alloca i32, align 4
call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !24, metadata !DIExpression(DW_OP_deref)), !dbg !25
call void @llvm.dbg.declare(metadata i32* %z, metadata !26, metadata !DIExpression()), !dbg !27
store i32 2, i32* %z, align 4, !dbg !27
%var = getelementptr inbounds %struct.A, %struct.A* %a, i32 0, i32 1, !dbg !28
%0 = load i32, i32* %var, align 4, !dbg !28
%cmp = icmp sgt i32 %0, 2, !dbg !28
br i1 %cmp, label %if.then, label %if.end, !dbg !28
if.then: ; preds = %entry
%1 = load i32, i32* %z, align 4, !dbg !30
%inc = add nsw i32 %1, 1, !dbg !30
store i32 %inc, i32* %z, align 4, !dbg !30
br label %if.end, !dbg !30
if.end: ; preds = %if.then, %entry
%call = call signext i8 @_ZN1A3fooEv(%struct.A* %a), !dbg !31
%conv = sext i8 %call to i32, !dbg !31
%cmp1 = icmp eq i32 %conv, 97, !dbg !31
br i1 %cmp1, label %if.then2, label %if.end4, !dbg !31
if.then2: ; preds = %if.end
%2 = load i32, i32* %z, align 4, !dbg !33
%inc3 = add nsw i32 %2, 1, !dbg !33
store i32 %inc3, i32* %z, align 4, !dbg !33
br label %if.end4, !dbg !33
if.end4: ; preds = %if.then2, %if.end
ret void, !dbg !34
}
declare signext i8 @_ZN1A3fooEv(%struct.A*) #2
attributes #0 = { nounwind "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" }
attributes #1 = { nounwind readnone }
attributes #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" }
!llvm.dbg.cu = !{!0, !9}
!llvm.module.flags = !{!18, !19}
!llvm.ident = !{!20, !20}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (210479)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
!1 = !DIFile(filename: "debug-loc-offset1.cc", directory: "/llvm_cmake_gcc")
!2 = !{}
!4 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
!5 = !DIFile(filename: "debug-loc-offset1.cc", directory: "/llvm_cmake_gcc")
!6 = !DISubroutineType(types: !7)
!7 = !{!8, !8}
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (210479)", isOptimized: false, emissionKind: FullDebug, file: !10, enums: !2, retainedTypes: !11, globals: !2, imports: !2)
!10 = !DIFile(filename: "debug-loc-offset2.cc", directory: "/llvm_cmake_gcc")
!11 = !{!12}
!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, flags: DIFlagFwdDecl, file: !10, identifier: "_ZTS1A")
!14 = distinct !DISubprogram(name: "baz", linkageName: "_Z3baz1A", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !9, scopeLine: 6, file: !10, scope: !15, type: !16, retainedNodes: !2)
!15 = !DIFile(filename: "debug-loc-offset2.cc", directory: "/llvm_cmake_gcc")
!16 = !DISubroutineType(types: !17)
!17 = !{null, !12}
!18 = !{i32 2, !"Dwarf Version", i32 4}
!19 = !{i32 2, !"Debug Info Version", i32 3}
!20 = !{!"clang version 3.5.0 (210479)"}
!21 = !DILocalVariable(name: "b", line: 1, arg: 1, scope: !4, file: !5, type: !8)
!22 = !DILocation(line: 1, scope: !4)
!23 = !DILocation(line: 2, scope: !4)
!24 = !DILocalVariable(name: "a", line: 6, arg: 1, scope: !14, file: !15, type: !12)
!25 = !DILocation(line: 6, scope: !14)
!26 = !DILocalVariable(name: "z", line: 7, scope: !14, file: !15, type: !8)
!27 = !DILocation(line: 7, scope: !14)
!28 = !DILocation(line: 8, scope: !29)
!29 = distinct !DILexicalBlock(line: 8, column: 0, file: !10, scope: !14)
!30 = !DILocation(line: 9, scope: !29)
!31 = !DILocation(line: 10, scope: !32)
!32 = distinct !DILexicalBlock(line: 10, column: 0, file: !10, scope: !14)
!33 = !DILocation(line: 11, scope: !32)
!34 = !DILocation(line: 12, scope: !14)

View File

@ -0,0 +1,276 @@
# RUN: llc -o - %s -start-after=patchable-function -filetype=obj -O0 -mtriple=i386-unknown-linux-gnu -dwarf-version=4 | llvm-dwarfdump -v - | FileCheck %s
# From the code:
#
# debug-loc-offset1.cc
# int bar (int b) {
# return b+4;
# }
#
# debug-loc-offset2.cc
# struct A {
# int var;
# virtual char foo();
# };
#
# void baz(struct A a) {
# int z = 2;
# if (a.var > 2)
# z++;
# if (a.foo() == 'a')
# z++;
# }
#
# Compiled separately for i386-pc-linux-gnu and linked together.
# This ensures that we have multiple compile units and multiple location lists
# so that we can verify that
# debug_loc entries are relative to the low_pc of the CU. The loc entry for
# the byval argument in foo.cpp is in the second CU and so should have
# an offset relative to that CU rather than from the beginning of the text
# section.
#
# Checking that we have two compile units with two sets of high/lo_pc.
# CHECK: .debug_info contents
# CHECK: DW_TAG_compile_unit
# CHECK: DW_AT_low_pc {{.*}} (0x0000000000000020)
# CHECK: DW_AT_high_pc
#
# CHECK: DW_TAG_subprogram
# CHECK-NOT: DW_TAG
# CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A"
# CHECK-NOT: {{DW_TAG|NULL}}
# CHECK: DW_TAG_formal_parameter
# CHECK-NOT: DW_TAG
# CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
# CHECK-NEXT: [0x00000020, 0x00000037): DW_OP_breg0 EAX+0, DW_OP_deref
# CHECK-NEXT: [0x00000037, 0x00000063): DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
# CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"a"
#
# CHECK: DW_TAG_variable
# CHECK: DW_AT_location [DW_FORM_exprloc]
# CHECK-NOT: DW_AT_location
#
# CHECK: DW_TAG_compile_unit
# CHECK: DW_AT_low_pc {{.*}} (0x0000000000000000)
# CHECK: DW_AT_high_pc
#
# CHECK: DW_TAG_subprogram
# CHECK-NOT: DW_TAG
# CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3bari"
# CHECK-NOT: {{DW_TAG|NULL}}
# CHECK: DW_TAG_formal_parameter
# CHECK-NOT: DW_TAG
# CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
# CHECK-NEXT: [0x00000000, 0x0000000a): DW_OP_consts +0, DW_OP_stack_value
# CHECK-NEXT: [0x0000000a, 0x00000017): DW_OP_consts +1, DW_OP_stack_value)
# CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"b"
#
# CHECK: .debug_loc contents:
# CHECK: 0x00000000:
# CHECK-NEXT: [0x00000000, 0x0000000a): DW_OP_consts +0, DW_OP_stack_value
# CHECK-NEXT: [0x0000000a, 0x00000017): DW_OP_consts +1, DW_OP_stack_value
# CHECK: 0x00000022:
# CHECK-NEXT: [0x00000000, 0x00000017): DW_OP_breg0 EAX+0, DW_OP_deref
# CHECK-NEXT: [0x00000017, 0x00000043): DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
--- |
target triple = "i386-unknown-linux-gnu"
%struct.A = type { i32 (...)**, i32 }
; Function Attrs: nounwind
define i32 @_Z3bari(i32 %b) #0 !dbg !10 {
entry:
%b.addr = alloca i32, align 4
store i32 %b, i32* %b.addr, align 4
call void @llvm.dbg.value(metadata i32 0, metadata !14, metadata !DIExpression()), !dbg !15
%0 = load i32, i32* %b.addr, align 4, !dbg !16
call void @llvm.dbg.value(metadata i32 1, metadata !14, metadata !DIExpression()), !dbg !15
%add = add nsw i32 %0, 4, !dbg !16
ret i32 %add, !dbg !16
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
define void @_Z3baz1A(%struct.A* %a) #2 !dbg !17 {
entry:
%z = alloca i32, align 4
call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !20, metadata !DIExpression(DW_OP_deref)), !dbg !21
call void @llvm.dbg.declare(metadata i32* %z, metadata !22, metadata !DIExpression()), !dbg !23
store i32 2, i32* %z, align 4, !dbg !23
%var = getelementptr inbounds %struct.A, %struct.A* %a, i32 0, i32 1, !dbg !24
%0 = load i32, i32* %var, align 4, !dbg !24
%cmp = icmp sgt i32 %0, 2, !dbg !24
br i1 %cmp, label %if.then, label %if.end, !dbg !24
if.then: ; preds = %entry
%1 = load i32, i32* %z, align 4, !dbg !26
%inc = add nsw i32 %1, 1, !dbg !26
store i32 %inc, i32* %z, align 4, !dbg !26
br label %if.end, !dbg !26
if.end: ; preds = %if.then, %entry
%call = call signext i8 @_ZN1A3fooEv(%struct.A* %a), !dbg !27
%conv = sext i8 %call to i32, !dbg !27
%cmp1 = icmp eq i32 %conv, 97, !dbg !27
br i1 %cmp1, label %if.then2, label %if.end4, !dbg !27
if.then2: ; preds = %if.end
%2 = load i32, i32* %z, align 4, !dbg !29
%inc3 = add nsw i32 %2, 1, !dbg !29
store i32 %inc3, i32* %z, align 4, !dbg !29
br label %if.end4, !dbg !29
if.end4: ; preds = %if.then2, %if.end
ret void, !dbg !30
}
declare signext i8 @_ZN1A3fooEv(%struct.A*) #2
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #3
attributes #0 = { nounwind "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" }
attributes #1 = { nounwind readnone speculatable }
attributes #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" }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0, !3}
!llvm.module.flags = !{!7, !8}
!llvm.ident = !{!9, !9}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.5.0 (210479)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
!1 = !DIFile(filename: "debug-loc-offset1.cc", directory: "/llvm_cmake_gcc")
!2 = !{}
!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !4, producer: "clang version 3.5.0 (210479)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !5, globals: !2, imports: !2)
!4 = !DIFile(filename: "debug-loc-offset2.cc", directory: "/llvm_cmake_gcc")
!5 = !{!6}
!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !4, line: 1, flags: DIFlagFwdDecl, identifier: "_ZTS1A")
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{!"clang version 3.5.0 (210479)"}
!10 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !1, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true, scopeLine: 1, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!11 = !DISubroutineType(types: !12)
!12 = !{!13, !13}
!13 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!14 = !DILocalVariable(name: "b", arg: 1, scope: !10, file: !1, line: 1, type: !13)
!15 = !DILocation(line: 1, scope: !10)
!16 = !DILocation(line: 2, scope: !10)
!17 = distinct !DISubprogram(name: "baz", linkageName: "_Z3baz1A", scope: !4, file: !4, line: 6, type: !18, isLocal: false, isDefinition: true, scopeLine: 6, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !3, retainedNodes: !2)
!18 = !DISubroutineType(types: !19)
!19 = !{null, !6}
!20 = !DILocalVariable(name: "a", arg: 1, scope: !17, file: !4, line: 6, type: !6)
!21 = !DILocation(line: 6, scope: !17)
!22 = !DILocalVariable(name: "z", scope: !17, file: !4, line: 7, type: !13)
!23 = !DILocation(line: 7, scope: !17)
!24 = !DILocation(line: 8, scope: !25)
!25 = distinct !DILexicalBlock(scope: !17, file: !4, line: 8)
!26 = !DILocation(line: 9, scope: !25)
!27 = !DILocation(line: 10, scope: !28)
!28 = distinct !DILexicalBlock(scope: !17, file: !4, line: 10)
!29 = !DILocation(line: 11, scope: !28)
!30 = !DILocation(line: 12, scope: !17)
...
---
name: _Z3bari
alignment: 4
tracksRegLiveness: true
frameInfo:
stackSize: 8
offsetAdjustment: -4
maxAlignment: 4
maxCallFrameSize: 0
fixedStack:
- { id: 0, type: spill-slot, offset: -8, size: 4, alignment: 8, stack-id: 0 }
- { id: 1, size: 4, alignment: 16, stack-id: 0 }
stack:
- { id: 0, type: spill-slot, offset: -12, size: 4, alignment: 4, stack-id: 0 }
body: |
bb.0.entry:
frame-setup PUSH32r killed $ebp, implicit-def $esp, implicit $esp
CFI_INSTRUCTION def_cfa_offset 8
CFI_INSTRUCTION offset $ebp, -8
$ebp = frame-setup MOV32rr $esp
CFI_INSTRUCTION def_cfa_register $ebp
frame-setup PUSH32r undef $eax, implicit-def $esp, implicit $esp
renamable $eax = MOV32rm $ebp, 1, $noreg, 8, $noreg :: (load 4 from %fixed-stack.1)
DBG_VALUE 0, 0, !14, !DIExpression(), debug-location !15
renamable $ecx = MOV32rm $ebp, 1, $noreg, 8, $noreg, debug-location !16 :: (load 4 from %ir.b.addr)
DBG_VALUE 1, 0, !14, !DIExpression(), debug-location !15
renamable $ecx = ADD32ri8 renamable $ecx, 4, implicit-def $eflags, debug-location !16
MOV32mr $ebp, 1, $noreg, -4, $noreg, killed $eax :: (store 4 into %fixed-stack.1)
$eax = MOV32rr killed $ecx, debug-location !16
$esp = frame-destroy ADD32ri8 $esp, 4, implicit-def dead $eflags, debug-location !16
$ebp = frame-destroy POP32r implicit-def $esp, implicit $esp, debug-location !16
CFI_INSTRUCTION def_cfa $esp, 4, debug-location !16
RETL implicit killed $eax, debug-location !16
...
---
name: _Z3baz1A
alignment: 4
tracksRegLiveness: true
frameInfo:
stackSize: 28
offsetAdjustment: -24
maxAlignment: 4
adjustsStack: true
hasCalls: true
maxCallFrameSize: 4
fixedStack:
- { id: 0, type: spill-slot, offset: -8, size: 4, alignment: 8, stack-id: 0 }
- { id: 1, size: 4, alignment: 16, stack-id: 0, isImmutable: true }
stack:
- { id: 0, name: z, offset: -12, size: 4, alignment: 4, stack-id: 0,
debug-info-variable: '!22', debug-info-expression: '!DIExpression()',
debug-info-location: '!23' }
- { id: 1, type: spill-slot, offset: -16, size: 4, alignment: 4, stack-id: 0 }
body: |
bb.0.entry:
frame-setup PUSH32r killed $ebp, implicit-def $esp, implicit $esp
CFI_INSTRUCTION def_cfa_offset 8
CFI_INSTRUCTION offset $ebp, -8
$ebp = frame-setup MOV32rr $esp
CFI_INSTRUCTION def_cfa_register $ebp
$esp = frame-setup SUB32ri8 $esp, 24, implicit-def dead $eflags
renamable $eax = MOV32rm $ebp, 1, $noreg, 8, $noreg :: (load 4 from %fixed-stack.1)
DBG_VALUE renamable $eax, 0, !20, !DIExpression(DW_OP_deref), debug-location !21
MOV32mi $ebp, 1, $noreg, -4, $noreg, 2, debug-location !23 :: (store 4 into %ir.z)
CMP32mi8 renamable $eax, 1, $noreg, 4, $noreg, 2, implicit-def $eflags, debug-location !24 :: (load 4 from %ir.var)
MOV32mr $ebp, 1, $noreg, -8, $noreg, killed $eax :: (store 4 into %stack.1)
DBG_VALUE $ebp, 0, !20, !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !21
JLE_1 %bb.2, implicit $eflags, debug-location !24
bb.1.if.then:
DBG_VALUE $ebp, 0, !20, !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !21
renamable $eax = MOV32rm $ebp, 1, $noreg, -4, $noreg, debug-location !26 :: (load 4 from %ir.z)
renamable $eax = ADD32ri8 renamable $eax, 1, implicit-def $eflags, debug-location !26
MOV32mr $ebp, 1, $noreg, -4, $noreg, killed renamable $eax, debug-location !26 :: (store 4 into %ir.z)
bb.2.if.end:
DBG_VALUE $ebp, 0, !20, !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !21
$eax = MOV32rm $ebp, 1, $noreg, -8, $noreg :: (load 4 from %stack.1)
MOV32mr $esp, 1, $noreg, 0, $noreg, killed renamable $eax, debug-location !27 :: (store 4 into stack)
CALLpcrel32 @_ZN1A3fooEv, csr_32, implicit $esp, implicit $ssp, implicit-def $al, debug-location !27
renamable $ecx = MOVSX32rr8 killed renamable $al, debug-location !27
CMP32ri8 killed renamable $ecx, 97, implicit-def $eflags, debug-location !27
JNE_1 %bb.4, implicit $eflags, debug-location !27
bb.3.if.then2:
DBG_VALUE $ebp, 0, !20, !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !21
renamable $eax = MOV32rm $ebp, 1, $noreg, -4, $noreg, debug-location !29 :: (load 4 from %ir.z)
renamable $eax = ADD32ri8 renamable $eax, 1, implicit-def $eflags, debug-location !29
MOV32mr $ebp, 1, $noreg, -4, $noreg, killed renamable $eax, debug-location !29 :: (store 4 into %ir.z)
bb.4.if.end4:
DBG_VALUE $ebp, 0, !20, !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !21
$esp = frame-destroy ADD32ri8 $esp, 24, implicit-def dead $eflags, debug-location !30
$ebp = frame-destroy POP32r implicit-def $esp, implicit $esp, debug-location !30
CFI_INSTRUCTION def_cfa $esp, 4, debug-location !30
RETL debug-location !30
...

View File

@ -1,80 +0,0 @@
; Test dwarf codegen of DW_OP_minus.
; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
; This was built by compiling the following source with SafeStack and
; simplifying the result a little.
; extern "C" {
; void Capture(int *);
; void f() {
; int buf[100];
; Capture(buf);
; }
; }
; The interesting part is !DIExpression(DW_OP_constu, 400, DW_OP_minus)
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
define void @f() !dbg !4 {
entry:
%unsafe_stack_ptr = load i8*, i8** @__safestack_unsafe_stack_ptr
%unsafe_stack_static_top = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
store i8* %unsafe_stack_static_top, i8** @__safestack_unsafe_stack_ptr
%0 = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
%buf = bitcast i8* %0 to [100 x i32]*
%1 = bitcast [100 x i32]* %buf to i8*, !dbg !16
call void @llvm.dbg.declare(metadata i8* %unsafe_stack_ptr, metadata !8, metadata !17), !dbg !18
%arraydecay = getelementptr inbounds [100 x i32], [100 x i32]* %buf, i64 0, i64 0, !dbg !19
call void @Capture(i32* %arraydecay), !dbg !20
store i8* %unsafe_stack_ptr, i8** @__safestack_unsafe_stack_ptr, !dbg !21
ret void, !dbg !21
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
declare void @Capture(i32*)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!13, !14}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "1.cc", directory: "/tmp")
!2 = !{}
!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !7)
!5 = !DISubroutineType(types: !6)
!6 = !{null}
!7 = !{!8}
!8 = !DILocalVariable(name: "buf", scope: !4, file: !1, line: 5, type: !9)
!9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 3200, align: 32, elements: !11)
!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!11 = !{!12}
!12 = !DISubrange(count: 100)
!13 = !{i32 2, !"Dwarf Version", i32 4}
!14 = !{i32 2, !"Debug Info Version", i32 3}
!15 = !{!"clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)"}
!16 = !DILocation(line: 5, column: 3, scope: !4)
!17 = !DIExpression(DW_OP_constu, 400, DW_OP_minus)
!18 = !DILocation(line: 5, column: 7, scope: !4)
!19 = !DILocation(line: 6, column: 11, scope: !4)
!20 = !DILocation(line: 6, column: 3, scope: !4)
!21 = !DILocation(line: 7, column: 1, scope: !4)
; RCX - 400
; CHECK: .short 3 # Loc expr size
; CHECK-NEXT: .byte 114 # DW_OP_breg2
; CHECK-NEXT: .byte 240 # -400
; CHECK-NEXT: .byte 124
; RCX is clobbered in call @Capture, but there is a spilled copy.
; *(RSP + 8) - 400
; CHECK: .short 7 # Loc expr size
; CHECK-NEXT: .byte 119 # DW_OP_breg7
; CHECK-NEXT: .byte 8 # 8
; CHECK-NEXT: .byte 6 # DW_OP_deref
; CHECK-NEXT: .byte 16 # DW_OP_constu
; CHECK-NEXT: .byte 144 # 400
; CHECK-NEXT: .byte 3 #
; CHECK-NEXT: .byte 28 # DW_OP_minus

View File

@ -0,0 +1,119 @@
# RUN: llc -o - %s -start-after=patchable-function -O0 -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
# Test dwarf codegen of DW_OP_minus.
#
# This was built by compiling the following source with SafeStack and
# simplifying the result a little.
# extern "C" {
# void Capture(int *);
# void f() {
# int buf[100];
# Capture(buf);
# }
# }
# The interesting part is !DIExpression(DW_OP_constu, 400, DW_OP_minus)
#
# RCX - 400
# CHECK: .short 3 # Loc expr size
# CHECK-NEXT: .byte 114 # DW_OP_breg2
# CHECK-NEXT: .byte 240 # -400
# CHECK-NEXT: .byte 124
#
# RCX is clobbered in call @Capture, but there is a spilled copy.
# *(RSP + 8) - 400
# CHECK: .short 7 # Loc expr size
# CHECK-NEXT: .byte 119 # DW_OP_breg7
# CHECK-NEXT: .byte 8 # 8
# CHECK-NEXT: .byte 6 # DW_OP_deref
# CHECK-NEXT: .byte 16 # DW_OP_constu
# CHECK-NEXT: .byte 144 # 400
# CHECK-NEXT: .byte 3 #
# CHECK-NEXT: .byte 28 # DW_OP_minus
--- |
@__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
define void @f() !dbg !5 {
entry:
%unsafe_stack_ptr = load i8*, i8** @__safestack_unsafe_stack_ptr
%unsafe_stack_static_top = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
store i8* %unsafe_stack_static_top, i8** @__safestack_unsafe_stack_ptr
%0 = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
%buf = bitcast i8* %0 to [100 x i32]*
%1 = bitcast [100 x i32]* %buf to i8*, !dbg !14
call void @llvm.dbg.declare(metadata i8* %unsafe_stack_ptr, metadata !9, metadata !DIExpression(DW_OP_constu, 400, DW_OP_minus)), !dbg !15
%arraydecay = getelementptr inbounds [100 x i32], [100 x i32]* %buf, i64 0, i64 0, !dbg !16
call void @Capture(i32* %arraydecay), !dbg !17
store i8* %unsafe_stack_ptr, i8** @__safestack_unsafe_stack_ptr, !dbg !18
ret void, !dbg !18
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
declare void @Capture(i32*)
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #1
attributes #0 = { nounwind readnone speculatable }
attributes #1 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "1.cc", directory: "/tmp")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8)
!6 = !DISubroutineType(types: !7)
!7 = !{null}
!8 = !{!9}
!9 = !DILocalVariable(name: "buf", scope: !5, file: !1, line: 5, type: !10)
!10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 3200, align: 32, elements: !12)
!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!12 = !{!13}
!13 = !DISubrange(count: 100)
!14 = !DILocation(line: 5, column: 3, scope: !5)
!15 = !DILocation(line: 5, column: 7, scope: !5)
!16 = !DILocation(line: 6, column: 11, scope: !5)
!17 = !DILocation(line: 6, column: 3, scope: !5)
!18 = !DILocation(line: 7, column: 1, scope: !5)
...
---
name: f
alignment: 4
tracksRegLiveness: true
frameInfo:
stackSize: 24
maxAlignment: 8
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
stack:
- { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: 0 }
- { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: 0 }
body: |
bb.0.entry:
$rsp = frame-setup SUB64ri8 $rsp, 24, implicit-def dead $eflags
CFI_INSTRUCTION def_cfa_offset 32
renamable $rax = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @__safestack_unsafe_stack_ptr, $noreg :: (load 8 from got)
renamable $rcx = MOV64rm renamable $rax, 1, $noreg, 0, $fs :: (dereferenceable load 8 from @__safestack_unsafe_stack_ptr)
DBG_VALUE renamable $rcx, 0, !9, !DIExpression(DW_OP_constu, 400, DW_OP_minus), debug-location !15
$rdx = MOV64rr $rcx
renamable $rdx = ADD64ri32 renamable $rdx, -400, implicit-def dead $eflags
MOV64mr renamable $rax, 1, $noreg, 0, $fs, renamable $rdx :: (store 8 into @__safestack_unsafe_stack_ptr)
$rdi = MOV64rr killed $rdx, debug-location !17
MOV64mr $rsp, 1, $noreg, 16, $noreg, killed $rax :: (store 8 into %stack.0)
MOV64mr $rsp, 1, $noreg, 8, $noreg, killed $rcx :: (store 8 into %stack.1)
DBG_VALUE $rsp, 0, !9, !DIExpression(DW_OP_plus_uconst, 8, DW_OP_deref, DW_OP_constu, 400, DW_OP_minus), debug-location !15
CALL64pcrel32 @Capture, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp, debug-location !17
$rax = MOV64rm $rsp, 1, $noreg, 16, $noreg :: (load 8 from %stack.0)
$rcx = MOV64rm $rsp, 1, $noreg, 8, $noreg :: (load 8 from %stack.1)
MOV64mr killed renamable $rax, 1, $noreg, 0, $fs, killed renamable $rcx, debug-location !18 :: (store 8 into @__safestack_unsafe_stack_ptr)
$rsp = frame-destroy ADD64ri8 $rsp, 24, implicit-def dead $eflags, debug-location !18
CFI_INSTRUCTION def_cfa_offset 8, debug-location !18
RETQ debug-location !18
...

View File

@ -1,144 +0,0 @@
; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
; Generated from the source file pr19307.cc:
; #include <string>
; void parse_range(unsigned long long &offset, unsigned long long &limit,
; std::string range) {
; if (range.compare(0, 6, "items=") != 0 || range[6] == '-')
; offset = 1;
; range.erase(0, 6);
; limit = 2;
; }
; with "clang++ -S -emit-llvm -O0 -g pr19307.cc"
; Location of "range" string is spilled from %rdx to stack and is
; addressed via %rbp.
; CHECK: movq %rdx, {{[-0-9]+}}(%rbp)
; CHECK-NEXT: [[START_LABEL:.Ltmp[0-9]+]]:
; This location should be valid until the end of the function.
; Verify that we have proper range in debug_loc section:
; CHECK: .Ldebug_loc{{[0-9]+}}:
; CHECK: DW_OP_breg1
; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
; CHECK-NEXT: .quad .Lfunc_end0-.Lfunc_begin0
; CHECK: DW_OP_breg6
; CHECK: DW_OP_deref
; ModuleID = 'pr19307.cc'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"class.std::basic_string" = type { %"struct.std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" }
%"struct.std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" = type { i8* }
@.str = private unnamed_addr constant [7 x i8] c"items=\00", align 1
; Function Attrs: uwtable
define void @_Z11parse_rangeRyS_Ss(i64* %offset, i64* %limit, %"class.std::basic_string"* %range) #0 !dbg !13 {
entry:
%offset.addr = alloca i64*, align 8
%limit.addr = alloca i64*, align 8
store i64* %offset, i64** %offset.addr, align 8
call void @llvm.dbg.declare(metadata i64** %offset.addr, metadata !45, metadata !DIExpression()), !dbg !46
store i64* %limit, i64** %limit.addr, align 8
call void @llvm.dbg.declare(metadata i64** %limit.addr, metadata !47, metadata !DIExpression()), !dbg !46
call void @llvm.dbg.declare(metadata %"class.std::basic_string"* %range, metadata !48, metadata !DIExpression(DW_OP_deref)), !dbg !49
%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
%cmp = icmp ne i32 %call, 0, !dbg !50
br i1 %cmp, label %if.then, label %lor.lhs.false, !dbg !50
lor.lhs.false: ; preds = %entry
%call1 = call i8* @_ZNSsixEm(%"class.std::basic_string"* %range, i64 6), !dbg !52
%0 = load i8, i8* %call1, !dbg !52
%conv = sext i8 %0 to i32, !dbg !52
%cmp2 = icmp eq i32 %conv, 45, !dbg !52
br i1 %cmp2, label %if.then, label %if.end, !dbg !52
if.then: ; preds = %lor.lhs.false, %entry
%1 = load i64*, i64** %offset.addr, align 8, !dbg !54
store i64 1, i64* %1, align 8, !dbg !54
br label %if.end, !dbg !54
if.end: ; preds = %if.then, %lor.lhs.false
%call3 = call %"class.std::basic_string"* @_ZNSs5eraseEmm(%"class.std::basic_string"* %range, i64 0, i64 6), !dbg !55
%2 = load i64*, i64** %limit.addr, align 8, !dbg !56
store i64 2, i64* %2, align 8, !dbg !56
ret void, !dbg !57
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare i32 @_ZNKSs7compareEmmPKc(%"class.std::basic_string"*, i64, i64, i8*) #2
declare i8* @_ZNSsixEm(%"class.std::basic_string"*, i64) #2
declare %"class.std::basic_string"* @_ZNSs5eraseEmm(%"class.std::basic_string"*, i64, i64) #2
attributes #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" }
attributes #1 = { nounwind readnone }
attributes #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" }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!42, !43}
!llvm.ident = !{!44}
!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)
!1 = !DIFile(filename: "pr19307.cc", directory: "/llvm_cmake_gcc")
!2 = !{}
!3 = !{!4, !6, !8}
!4 = !DICompositeType(tag: DW_TAG_structure_type, line: 83, flags: DIFlagFwdDecl, file: !5, identifier: "_ZTS11__mbstate_t")
!5 = !DIFile(filename: "/usr/include/wchar.h", directory: "/llvm_cmake_gcc")
!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "lconv", line: 54, flags: DIFlagFwdDecl, file: !7, identifier: "_ZTS5lconv")
!7 = !DIFile(filename: "/usr/include/locale.h", directory: "/llvm_cmake_gcc")
!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")
!9 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.tcc", directory: "/llvm_cmake_gcc")
!10 = !DINamespace(name: "std", scope: null)
!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")
!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, retainedNodes: !2)
!14 = !DIFile(filename: "pr19307.cc", directory: "/llvm_cmake_gcc")
!15 = !DISubroutineType(types: !16)
!16 = !{null, !17, !17, !19}
!17 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !18)
!18 = !DIBasicType(tag: DW_TAG_base_type, name: "long long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "string", line: 65, file: !20, scope: !10, baseType: !8)
!20 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/stringfwd.h", directory: "/llvm_cmake_gcc")
!21 = !{!22, !26, !29, !33, !38, !41}
!22 = !DIImportedEntity(tag: DW_TAG_imported_module, file: !1, line: 57, scope: !23, entity: !25)
!23 = !DINamespace(name: "__gnu_debug", scope: null)
!24 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/debug/debug.h", directory: "/llvm_cmake_gcc")
!25 = !DINamespace(name: "__debug", scope: !10)
!26 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 66, scope: !10, entity: !27)
!27 = !DIDerivedType(tag: DW_TAG_typedef, name: "mbstate_t", line: 106, file: !5, baseType: !28)
!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "__mbstate_t", line: 95, file: !5, baseType: !4)
!29 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 141, scope: !10, entity: !30)
!30 = !DIDerivedType(tag: DW_TAG_typedef, name: "wint_t", line: 141, file: !31, baseType: !32)
!31 = !DIFile(filename: "/llvm_cmake_gcc/bin/../lib/clang/3.5.0/include/stddef.h", directory: "/llvm_cmake_gcc")
!32 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
!33 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 42, scope: !34, entity: !36)
!34 = !DINamespace(name: "__gnu_cxx", scope: null)
!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")
!36 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", line: 155, file: !11, scope: !10, baseType: !37)
!37 = !DIBasicType(tag: DW_TAG_base_type, name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
!38 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 43, scope: !34, entity: !39)
!39 = !DIDerivedType(tag: DW_TAG_typedef, name: "ptrdiff_t", line: 156, file: !11, scope: !10, baseType: !40)
!40 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
!41 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 55, scope: !10, entity: !6)
!42 = !{i32 2, !"Dwarf Version", i32 4}
!43 = !{i32 2, !"Debug Info Version", i32 3}
!44 = !{!"clang version 3.5.0 (209308)"}
!45 = !DILocalVariable(name: "offset", line: 3, arg: 1, scope: !13, file: !14, type: !17)
!46 = !DILocation(line: 3, scope: !13)
!47 = !DILocalVariable(name: "limit", line: 3, arg: 2, scope: !13, file: !14, type: !17)
!48 = !DILocalVariable(name: "range", line: 4, arg: 3, scope: !13, file: !14, type: !19)
!49 = !DILocation(line: 4, scope: !13)
!50 = !DILocation(line: 5, scope: !51)
!51 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !13)
!52 = !DILocation(line: 5, scope: !53)
!53 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !51)
!54 = !DILocation(line: 6, scope: !51)
!55 = !DILocation(line: 7, scope: !13)
!56 = !DILocation(line: 8, scope: !13)
!57 = !DILocation(line: 9, scope: !13)

View File

@ -0,0 +1,224 @@
# RUN: llc -o - %s -start-after=patchable-function -O0 | FileCheck %s
# Generated from the source file pr19307.cc:
# #include <string>
# void parse_range(unsigned long long &offset, unsigned long long &limit,
# std::string range) {
# if (range.compare(0, 6, "items=") != 0 || range[6] == '-')
# offset = 1;
# range.erase(0, 6);
# limit = 2;
# }
# with "clang++ -S -emit-llvm -O0 -g pr19307.cc"
#
# Location of "range" string is spilled from %rdx to stack and is
# addressed via %rbp.
# CHECK: movq %rdx, {{[-0-9]+}}(%rbp)
# CHECK-NEXT: [[START_LABEL:.Ltmp[0-9]+]]:
# This location should be valid until the end of the function.
#
# Verify that we have proper range in debug_loc section:
# CHECK: .Ldebug_loc{{[0-9]+}}:
# CHECK: DW_OP_breg1
# CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
# CHECK-NEXT: .quad .Lfunc_end0-.Lfunc_begin0
# CHECK: DW_OP_breg6
# CHECK: DW_OP_deref
--- |
target triple = "x86_64-unknown-linux-gnu"
%"class.std::basic_string" = type { %"struct.std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" }
%"struct.std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" = type { i8* }
@.str = private unnamed_addr constant [7 x i8] c"items=\00", align 1
; Function Attrs: uwtable
define void @_Z11parse_rangeRyS_Ss(i64* %offset, i64* %limit, %"class.std::basic_string"* %range) #0 !dbg !34 {
entry:
%offset.addr = alloca i64*, align 8
%limit.addr = alloca i64*, align 8
store i64* %offset, i64** %offset.addr, align 8
call void @llvm.dbg.declare(metadata i64** %offset.addr, metadata !41, metadata !DIExpression()), !dbg !42
store i64* %limit, i64** %limit.addr, align 8
call void @llvm.dbg.declare(metadata i64** %limit.addr, metadata !43, metadata !DIExpression()), !dbg !42
call void @llvm.dbg.declare(metadata %"class.std::basic_string"* %range, metadata !44, metadata !DIExpression(DW_OP_deref)), !dbg !45
%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 !46
%cmp = icmp ne i32 %call, 0, !dbg !46
br i1 %cmp, label %if.then, label %lor.lhs.false, !dbg !46
lor.lhs.false: ; preds = %entry
%call1 = call i8* @_ZNSsixEm(%"class.std::basic_string"* %range, i64 6), !dbg !48
%0 = load i8, i8* %call1, !dbg !48
%conv = sext i8 %0 to i32, !dbg !48
%cmp2 = icmp eq i32 %conv, 45, !dbg !48
br i1 %cmp2, label %if.then, label %if.end, !dbg !48
if.then: ; preds = %lor.lhs.false, %entry
%1 = load i64*, i64** %offset.addr, align 8, !dbg !50
store i64 1, i64* %1, align 8, !dbg !50
br label %if.end, !dbg !50
if.end: ; preds = %if.then, %lor.lhs.false
%call3 = call %"class.std::basic_string"* @_ZNSs5eraseEmm(%"class.std::basic_string"* %range, i64 0, i64 6), !dbg !51
%2 = load i64*, i64** %limit.addr, align 8, !dbg !52
store i64 2, i64* %2, align 8, !dbg !52
ret void, !dbg !53
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare i32 @_ZNKSs7compareEmmPKc(%"class.std::basic_string"*, i64, i64, i8*) #2
declare i8* @_ZNSsixEm(%"class.std::basic_string"*, i64) #2
declare %"class.std::basic_string"* @_ZNSs5eraseEmm(%"class.std::basic_string"*, i64, i64) #2
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #3
attributes #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" }
attributes #1 = { nounwind readnone speculatable }
attributes #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" }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!31, !32}
!llvm.ident = !{!33}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.5.0 (209308)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2, imports: !11)
!1 = !DIFile(filename: "pr19307.cc", directory: "/llvm_cmake_gcc")
!2 = !{}
!3 = !{!4, !6, !8}
!4 = !DICompositeType(tag: DW_TAG_structure_type, file: !5, line: 83, flags: DIFlagFwdDecl, identifier: "_ZTS11__mbstate_t")
!5 = !DIFile(filename: "/usr/include/wchar.h", directory: "/llvm_cmake_gcc")
!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "lconv", file: !7, line: 54, flags: DIFlagFwdDecl, identifier: "_ZTS5lconv")
!7 = !DIFile(filename: "/usr/include/locale.h", directory: "/llvm_cmake_gcc")
!8 = !DICompositeType(tag: DW_TAG_class_type, name: "basic_string<char, std::char_traits<char>, std::allocator<char> >", scope: !10, file: !9, line: 1134, flags: DIFlagFwdDecl, identifier: "_ZTSSs")
!9 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.tcc", directory: "/llvm_cmake_gcc")
!10 = !DINamespace(name: "std", scope: null)
!11 = !{!12, !15, !18, !22, !27, !30}
!12 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !13, entity: !14, file: !1, line: 57)
!13 = !DINamespace(name: "__gnu_debug", scope: null)
!14 = !DINamespace(name: "__debug", scope: !10)
!15 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !10, entity: !16, file: !1, line: 66)
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "mbstate_t", file: !5, line: 106, baseType: !17)
!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "__mbstate_t", file: !5, line: 95, baseType: !4)
!18 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !10, entity: !19, file: !1, line: 141)
!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "wint_t", file: !20, line: 141, baseType: !21)
!20 = !DIFile(filename: "/llvm_cmake_gcc/bin/../lib/clang/3.5.0/include/stddef.h", directory: "/llvm_cmake_gcc")
!21 = !DIBasicType(name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
!22 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !23, entity: !24, file: !1, line: 42)
!23 = !DINamespace(name: "__gnu_cxx", scope: null)
!24 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", scope: !10, file: !25, line: 155, baseType: !26)
!25 = !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")
!26 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
!27 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !23, entity: !28, file: !1, line: 43)
!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "ptrdiff_t", scope: !10, file: !25, line: 156, baseType: !29)
!29 = !DIBasicType(name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
!30 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !10, entity: !6, file: !1, line: 55)
!31 = !{i32 2, !"Dwarf Version", i32 4}
!32 = !{i32 2, !"Debug Info Version", i32 3}
!33 = !{!"clang version 3.5.0 (209308)"}
!34 = distinct !DISubprogram(name: "parse_range", linkageName: "_Z11parse_rangeRyS_Ss", scope: !1, file: !1, line: 3, type: !35, isLocal: false, isDefinition: true, scopeLine: 4, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!35 = !DISubroutineType(types: !36)
!36 = !{null, !37, !37, !39}
!37 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !38)
!38 = !DIBasicType(name: "long long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
!39 = !DIDerivedType(tag: DW_TAG_typedef, name: "string", scope: !10, file: !40, line: 65, baseType: !8)
!40 = !DIFile(filename: "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/stringfwd.h", directory: "/llvm_cmake_gcc")
!41 = !DILocalVariable(name: "offset", arg: 1, scope: !34, file: !1, line: 3, type: !37)
!42 = !DILocation(line: 3, scope: !34)
!43 = !DILocalVariable(name: "limit", arg: 2, scope: !34, file: !1, line: 3, type: !37)
!44 = !DILocalVariable(name: "range", arg: 3, scope: !34, file: !1, line: 4, type: !39)
!45 = !DILocation(line: 4, scope: !34)
!46 = !DILocation(line: 5, scope: !47)
!47 = distinct !DILexicalBlock(scope: !34, file: !1, line: 5)
!48 = !DILocation(line: 5, scope: !49)
!49 = distinct !DILexicalBlock(scope: !47, file: !1, line: 5)
!50 = !DILocation(line: 6, scope: !47)
!51 = !DILocation(line: 7, scope: !34)
!52 = !DILocation(line: 8, scope: !34)
!53 = !DILocation(line: 9, scope: !34)
...
---
name: _Z11parse_rangeRyS_Ss
alignment: 4
tracksRegLiveness: true
liveins:
- { reg: '$rdi' }
- { reg: '$rsi' }
- { reg: '$rdx' }
frameInfo:
stackSize: 40
offsetAdjustment: -32
maxAlignment: 8
adjustsStack: true
hasCalls: true
maxCallFrameSize: 0
fixedStack:
- { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: 0 }
stack:
- { id: 0, name: offset.addr, offset: -24, size: 8, alignment: 8, stack-id: 0,
debug-info-variable: '!41', debug-info-expression: '!DIExpression()',
debug-info-location: '!42' }
- { id: 1, name: limit.addr, offset: -32, size: 8, alignment: 8, stack-id: 0,
debug-info-variable: '!43', debug-info-expression: '!DIExpression()',
debug-info-location: '!42' }
- { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: 0 }
- { id: 3, type: spill-slot, offset: -48, size: 8, alignment: 8, stack-id: 0 }
body: |
bb.0.entry:
liveins: $rdi, $rsi, $rdx
frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 16
CFI_INSTRUCTION offset $rbp, -16
$rbp = frame-setup MOV64rr $rsp
CFI_INSTRUCTION def_cfa_register $rbp
$rsp = frame-setup SUB64ri8 $rsp, 32, implicit-def dead $eflags
$eax = XOR32rr undef $eax, undef $eax, implicit-def $eflags, implicit-def $rax
MOV64mr $rbp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %ir.offset.addr)
MOV64mr $rbp, 1, $noreg, -16, $noreg, killed renamable $rsi :: (store 8 into %ir.limit.addr)
DBG_VALUE renamable $rdx, 0, !44, !DIExpression(DW_OP_deref), debug-location !45
$rdi = MOV64rr $rdx, debug-location !46
$rsi = MOV64rr killed $rax, debug-location !46
$eax = MOV32ri 6, implicit-def $rax, debug-location !46
MOV64mr $rbp, 1, $noreg, -24, $noreg, killed $rdx :: (store 8 into %stack.2)
DBG_VALUE $rbp, 0, !44, !DIExpression(DW_OP_constu, 24, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !45
$rdx = MOV64rr killed $rax, debug-location !46
renamable $rcx = MOV64ri @.str, debug-location !46
CALL64pcrel32 @_ZNKSs7compareEmmPKc, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit killed $rdx, implicit killed $rcx, implicit-def $eax, debug-location !46
CMP32ri8 killed renamable $eax, 0, implicit-def $eflags, debug-location !46
JNE_1 %bb.2, implicit $eflags, debug-location !46
bb.1.lor.lhs.false:
DBG_VALUE $rbp, 0, !44, !DIExpression(DW_OP_constu, 24, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !45
$rdi = MOV64rm $rbp, 1, $noreg, -24, $noreg :: (load 8 from %stack.2)
$esi = MOV32ri 6, implicit-def $rsi, debug-location !48
CALL64pcrel32 @_ZNSsixEm, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit-def $rax, debug-location !48
renamable $ecx = MOVSX32rm8 killed renamable $rax, 1, $noreg, 0, $noreg, debug-location !48 :: (load 1 from %ir.call1)
CMP32ri8 killed renamable $ecx, 45, implicit-def $eflags, debug-location !48
JNE_1 %bb.3, implicit $eflags, debug-location !48
bb.2.if.then:
DBG_VALUE $rbp, 0, !44, !DIExpression(DW_OP_constu, 24, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !45
renamable $rax = MOV64rm $rbp, 1, $noreg, -8, $noreg, debug-location !50 :: (load 8 from %ir.offset.addr)
MOV64mi32 killed renamable $rax, 1, $noreg, 0, $noreg, 1, debug-location !50 :: (store 8 into %ir.1)
bb.3.if.end:
DBG_VALUE $rbp, 0, !44, !DIExpression(DW_OP_constu, 24, DW_OP_minus, DW_OP_deref, DW_OP_deref), debug-location !45
$esi = XOR32rr undef $esi, undef $esi, implicit-def $eflags, implicit-def $rsi
$rdi = MOV64rm $rbp, 1, $noreg, -24, $noreg :: (load 8 from %stack.2)
$edx = MOV32ri 6, implicit-def $rdx, debug-location !51
CALL64pcrel32 @_ZNSs5eraseEmm, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit killed $rdx, implicit-def $rax, debug-location !51
renamable $rdx = MOV64rm $rbp, 1, $noreg, -16, $noreg, debug-location !52 :: (load 8 from %ir.limit.addr)
MOV64mi32 killed renamable $rdx, 1, $noreg, 0, $noreg, 2, debug-location !52 :: (store 8 into %ir.2)
MOV64mr $rbp, 1, $noreg, -32, $noreg, killed $rax :: (store 8 into %stack.3)
$rsp = frame-destroy ADD64ri8 $rsp, 32, implicit-def dead $eflags, debug-location !53
$rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !53
CFI_INSTRUCTION def_cfa $rsp, 8, debug-location !53
RETQ debug-location !53
...