Skip to content

Commit 02e816b

Browse files
author
Evan Cheng
committed
Do not try to optimize a copy that has already been marked for deletion.
llvm-svn: 102027
1 parent e5798dc commit 02e816b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,8 @@ SimpleRegisterCoalescing::UpdateRegDefsUses(unsigned SrcReg, unsigned DstReg,
804804
CopySrcReg == SrcReg && CopyDstReg != UseDstReg) {
805805
// If the use is a copy and it won't be coalesced away, and its source
806806
// is defined by a trivial computation, try to rematerialize it instead.
807-
if (ReMaterializeTrivialDef(li_->getInterval(SrcReg), CopyDstReg,
807+
if (!JoinedCopies.count(UseMI) &&
808+
ReMaterializeTrivialDef(li_->getInterval(SrcReg), CopyDstReg,
808809
CopyDstSubIdx, UseMI))
809810
continue;
810811
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: llc < %s -mtriple=x86_64-apple-darwin
2+
; rdar://7886733
3+
4+
%struct.CMTime = type <{ i64, i32, i32, i64 }>
5+
%struct.CMTimeMapping = type { %struct.CMTimeRange, %struct.CMTimeRange }
6+
%struct.CMTimeRange = type { %struct.CMTime, %struct.CMTime }
7+
8+
define void @t(%struct.CMTimeMapping* noalias nocapture sret %agg.result) nounwind optsize ssp {
9+
entry:
10+
%agg.result1 = bitcast %struct.CMTimeMapping* %agg.result to i8* ; <i8*> [#uses=1]
11+
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.result1, i8* null, i64 96, i32 4, i1 false)
12+
ret void
13+
}
14+
15+
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind

0 commit comments

Comments
 (0)