1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Simplify implementation and testcase of r223401 based on feedback from dblaikie.

llvm-svn: 223405
This commit is contained in:
Adrian Prantl 2014-12-04 22:58:41 +00:00
parent 117e0306b1
commit 2a019cf6d0
2 changed files with 20 additions and 27 deletions

View File

@ -901,13 +901,11 @@ bool RegisterCoalescer::reMaterializeTrivialDef(CoalescerPair &CP,
if (!DeadDefs.empty()) {
// If the virtual SrcReg is completely eliminated, update all DBG_VALUEs
// to describe DstReg instead.
for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(SrcReg),
UE = MRI->use_end(); UI != UE; ++UI) {
MachineOperand &UseMO = *UI;
for (MachineOperand &UseMO : MRI->use_operands(SrcReg)) {
MachineInstr *UseMI = UseMO.getParent();
if (UseMI->isDebugValue()) {
UseMO.setReg(DstReg);
DEBUG({dbgs() << "\t\tupdated: " << *UseMI;});
DEBUG(dbgs() << "\t\tupdated: " << *UseMI);
}
}
eliminateDeadDefs();

View File

@ -1,12 +1,12 @@
; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
;
; Generated at -Os from:
; void *my_memcpy(void *dst, const void * src, long n);
; void* getBytesNoCopy();
; void *foo(void *dst);
; void start() {
; unsigned size;
; my_memcpy(&size, getBytesNoCopy(), sizeof(size));
; if (size != 0) { }
; foo(&size);
; if (size != 0) {
; }
; }
; ModuleID = 'test1.cpp'
@ -18,23 +18,19 @@ define void @_Z5startv() #0 {
entry:
%size = alloca i32, align 4
%0 = bitcast i32* %size to i8*, !dbg !15
%call = tail call i8* @_Z14getBytesNoCopyv() #3, !dbg !16
%call1 = call i8* @_Z9my_memcpyPvPKvl(i8* %0, i8* %call, i64 4) #3, !dbg !15
call void @llvm.dbg.value(metadata !{i32* %size}, i64 0, metadata !10, metadata !17), !dbg !18
%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 !19
ret void, !dbg !18
}
; Function Attrs: optsize
declare i8* @_Z9my_memcpyPvPKvl(i8*, i8*, i64) #1
; Function Attrs: optsize
declare i8* @_Z14getBytesNoCopyv() #1
declare i8* @_Z3fooPv(i8*) #1
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
@ -48,23 +44,22 @@ attributes #3 = { nounwind optsize }
!llvm.module.flags = !{!12, !13}
!llvm.ident = !{!14}
!0 = metadata !{metadata !"0x11\004\00clang version 3.6.0 (trunk 223149) (llvm/trunk 223153)\001\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [/<stdin>] [DW_LANG_C_plus_plus]
!0 = metadata !{metadata !"0x11\004\00clang version 3.6.0 (trunk 223149) (llvm/trunk 223115)\001\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [<stdin>] [DW_LANG_C_plus_plus]
!1 = metadata !{metadata !"<stdin>", metadata !""}
!2 = metadata !{}
!3 = metadata !{metadata !4}
!4 = metadata !{metadata !"0x2e\00start\00start\00_Z5startv\003\000\001\000\000\00256\001\004", metadata !5, metadata !6, metadata !7, null, void ()* @_Z5startv, null, null, metadata !9} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 4] [start]
!5 = metadata !{metadata !"test1.cpp", metadata !""}
!6 = metadata !{metadata !"0x29", metadata !5} ; [ DW_TAG_file_type ] [/test1.cpp]
!4 = metadata !{metadata !"0x2e\00start\00start\00_Z5startv\002\000\001\000\000\00256\001\003", metadata !5, metadata !6, metadata !7, null, void ()* @_Z5startv, null, null, metadata !9} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 3] [start]
!5 = metadata !{metadata !"test1.c", metadata !""}
!6 = metadata !{metadata !"0x29", metadata !5} ; [ DW_TAG_file_type ] [/test1.c]
!7 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", null, null, null, metadata !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!8 = metadata !{null}
!9 = metadata !{metadata !10}
!10 = metadata !{metadata !"0x100\00size\005\000", metadata !4, metadata !6, metadata !11} ; [ DW_TAG_auto_variable ] [size] [line 5]
!10 = metadata !{metadata !"0x100\00size\004\000", metadata !4, metadata !6, metadata !11} ; [ DW_TAG_auto_variable ] [size] [line 4]
!11 = metadata !{metadata !"0x24\00unsigned int\000\0032\0032\000\000\007", null, null} ; [ DW_TAG_base_type ] [unsigned int] [line 0, size 32, align 32, offset 0, enc DW_ATE_unsigned]
!12 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
!13 = metadata !{i32 2, metadata !"Debug Info Version", i32 2}
!14 = metadata !{metadata !"clang version 3.6.0 (trunk 223149) (llvm/trunk 223153)"}
!15 = metadata !{i32 6, i32 3, metadata !4, null}
!16 = metadata !{i32 6, i32 25, metadata !4, null}
!17 = metadata !{metadata !"0x102"} ; [ DW_TAG_expression ]
!18 = metadata !{i32 5, i32 12, metadata !4, null}
!19 = metadata !{i32 9, i32 1, metadata !4, null}
!14 = metadata !{metadata !"clang version 3.6.0 (trunk 223149) (llvm/trunk 223115)"}
!15 = metadata !{i32 5, i32 3, metadata !4, null}
!16 = metadata !{metadata !"0x102"} ; [ DW_TAG_expression ]
!17 = metadata !{i32 4, i32 12, metadata !4, null}
!18 = metadata !{i32 8, i32 1, metadata !4, null}