mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
53320e0722
Summary: First up is instcombine, where in the dbg.declare -> dbg.value conversion, the llvm.dbg.value needs to be called on the actual loaded value, rather than the address (since the whole point of this transformation is to be able to get rid of the alloca). Further, now that that's cleaned up, we can remove a hack in the backend, that would add an implicit OP_deref if the argument to dbg.value was an alloca. This stems from before the existence of DIExpression and is no longer necessary since the deref can be expressed explicitly. Now, in order to make sure that the tests pass with this change, we need to correct the printing of DEBUG_VALUE comments to take into account the expression, which wasn't taken into account before. Unfortunately, for both these changes, there were a number of incorrect test cases (mostly the wrong number of DW_OP_derefs, but also a couple where the test itself was broken more badly). aprantl and I have gone through and adjusted these test case in order to make them pass with these fixes and in some cases to make sure they're actually testing what they are meant to test. Reviewers: aprantl Subscribers: dsanders Differential Revision: http://reviews.llvm.org/D14186 llvm-svn: 256077
66 lines
2.4 KiB
LLVM
66 lines
2.4 KiB
LLVM
; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
|
|
;
|
|
; Generated at -Os from:
|
|
; void *foo(void *dst);
|
|
; void start() {
|
|
; unsigned size;
|
|
; foo(&size);
|
|
; if (size != 0) { // Work around a bug to preserve the dbg.value.
|
|
; }
|
|
; }
|
|
|
|
; ModuleID = 'test1.cpp'
|
|
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
|
|
target triple = "arm64-apple-ios"
|
|
|
|
; Function Attrs: nounwind optsize
|
|
define void @_Z5startv() #0 !dbg !4 {
|
|
entry:
|
|
%size = alloca i32, align 4
|
|
%0 = bitcast i32* %size to i8*, !dbg !15
|
|
%call = call i8* @_Z3fooPv(i8* %0) #3, !dbg !15
|
|
call void @llvm.dbg.value(metadata i32* %size, i64 0, metadata !10, metadata !16), !dbg !17
|
|
; CHECK: .debug_info contents:
|
|
; CHECK: DW_TAG_variable
|
|
; CHECK-NEXT: DW_AT_location
|
|
; CHECK-NEXT: DW_AT_name {{.*}}"size"
|
|
; CHECK: .debug_loc contents:
|
|
; CHECK: Location description: 70 00
|
|
ret void, !dbg !18
|
|
}
|
|
|
|
; Function Attrs: optsize
|
|
declare i8* @_Z3fooPv(i8*) #1
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
|
|
|
|
attributes #0 = { nounwind optsize }
|
|
attributes #1 = { optsize }
|
|
attributes #2 = { nounwind readnone }
|
|
attributes #3 = { nounwind optsize }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!12, !13}
|
|
!llvm.ident = !{!14}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 223149) (llvm/trunk 223115)", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
|
!1 = !DIFile(filename: "<stdin>", directory: "")
|
|
!2 = !{}
|
|
!3 = !{!4}
|
|
!4 = distinct !DISubprogram(name: "start", linkageName: "_Z5startv", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !5, scope: !6, type: !7, variables: !9)
|
|
!5 = !DIFile(filename: "test1.c", directory: "")
|
|
!6 = !DIFile(filename: "test1.c", directory: "")
|
|
!7 = !DISubroutineType(types: !8)
|
|
!8 = !{null}
|
|
!9 = !{!10}
|
|
!10 = !DILocalVariable(name: "size", line: 4, scope: !4, file: !6, type: !11)
|
|
!11 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
|
|
!12 = !{i32 2, !"Dwarf Version", i32 2}
|
|
!13 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!14 = !{!"clang version 3.6.0 (trunk 223149) (llvm/trunk 223115)"}
|
|
!15 = !DILocation(line: 5, column: 3, scope: !4)
|
|
!16 = !DIExpression(DW_OP_deref)
|
|
!17 = !DILocation(line: 4, column: 12, scope: !4)
|
|
!18 = !DILocation(line: 8, column: 1, scope: !4)
|