mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-24 12:20:00 +00:00
Allow for loops in LiveIntervals::pruneValue().
It is possible that the live range of the value being pruned loops back into the kill MBB where the search started. When that happens, make sure that the beginning of KillMBB is also pruned. Instead of starting a DFS at KillMBB and skipping the root of the search, start a DFS at each KillMBB successor, and allow the search to loop back to KillMBB. This fixes PR14078. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f8b65aaf39
commit
af89690760
@ -761,38 +761,41 @@ void LiveIntervals::pruneValue(LiveInterval *LI, SlotIndex Kill,
|
||||
LI->removeRange(Kill, MBBEnd);
|
||||
if (EndPoints) EndPoints->push_back(MBBEnd);
|
||||
|
||||
// Find all blocks that are reachable from MBB without leaving VNI's live
|
||||
// range.
|
||||
for (df_iterator<MachineBasicBlock*>
|
||||
I = df_begin(KillMBB), E = df_end(KillMBB); I != E;) {
|
||||
MachineBasicBlock *MBB = *I;
|
||||
// KillMBB itself was already handled.
|
||||
if (MBB == KillMBB) {
|
||||
// Find all blocks that are reachable from KillMBB without leaving VNI's live
|
||||
// range. It is possible that KillMBB itself is reachable, so start a DFS
|
||||
// from each successor.
|
||||
typedef SmallPtrSet<MachineBasicBlock*, 9> VisitedTy;
|
||||
VisitedTy Visited;
|
||||
for (MachineBasicBlock::succ_iterator
|
||||
SuccI = KillMBB->succ_begin(), SuccE = KillMBB->succ_end();
|
||||
SuccI != SuccE; ++SuccI) {
|
||||
for (df_ext_iterator<MachineBasicBlock*, VisitedTy>
|
||||
I = df_ext_begin(*SuccI, Visited), E = df_ext_end(*SuccI, Visited);
|
||||
I != E;) {
|
||||
MachineBasicBlock *MBB = *I;
|
||||
|
||||
// Check if VNI is live in to MBB.
|
||||
tie(MBBStart, MBBEnd) = Indexes->getMBBRange(MBB);
|
||||
LiveRangeQuery LRQ(*LI, MBBStart);
|
||||
if (LRQ.valueIn() != VNI) {
|
||||
// This block isn't part of the VNI live range. Prune the search.
|
||||
I.skipChildren();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prune the search if VNI is killed in MBB.
|
||||
if (LRQ.endPoint() < MBBEnd) {
|
||||
LI->removeRange(MBBStart, LRQ.endPoint());
|
||||
if (EndPoints) EndPoints->push_back(LRQ.endPoint());
|
||||
I.skipChildren();
|
||||
continue;
|
||||
}
|
||||
|
||||
// VNI is live through MBB.
|
||||
LI->removeRange(MBBStart, MBBEnd);
|
||||
if (EndPoints) EndPoints->push_back(MBBEnd);
|
||||
++I;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if VNI is live in to MBB.
|
||||
tie(MBBStart, MBBEnd) = Indexes->getMBBRange(MBB);
|
||||
LiveRangeQuery LRQ(*LI, MBBStart);
|
||||
if (LRQ.valueIn() != VNI) {
|
||||
// This block isn't part of the VNI live range. Prune the search.
|
||||
I.skipChildren();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prune the search if VNI is killed in MBB.
|
||||
if (LRQ.endPoint() < MBBEnd) {
|
||||
LI->removeRange(MBBStart, LRQ.endPoint());
|
||||
if (EndPoints) EndPoints->push_back(LRQ.endPoint());
|
||||
I.skipChildren();
|
||||
continue;
|
||||
}
|
||||
|
||||
// VNI is live through MBB.
|
||||
LI->removeRange(MBBStart, MBBEnd);
|
||||
if (EndPoints) EndPoints->push_back(MBBEnd);
|
||||
++I;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,3 +214,52 @@ loop.end:
|
||||
%d.end = phi double [ 0.0, %entry ], [ %add, %after_inner_loop ]
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: pr14078
|
||||
define arm_aapcs_vfpcc i32 @pr14078(i8* nocapture %arg, i8* nocapture %arg1, i32 %arg2) nounwind uwtable readonly {
|
||||
bb:
|
||||
br i1 undef, label %bb31, label %bb3
|
||||
|
||||
bb3: ; preds = %bb12, %bb
|
||||
%tmp = shufflevector <2 x i64> undef, <2 x i64> undef, <1 x i32> zeroinitializer
|
||||
%tmp4 = bitcast <1 x i64> %tmp to <2 x float>
|
||||
%tmp5 = shufflevector <2 x float> %tmp4, <2 x float> undef, <4 x i32> zeroinitializer
|
||||
%tmp6 = bitcast <4 x float> %tmp5 to <2 x i64>
|
||||
%tmp7 = shufflevector <2 x i64> %tmp6, <2 x i64> undef, <1 x i32> zeroinitializer
|
||||
%tmp8 = bitcast <1 x i64> %tmp7 to <2 x float>
|
||||
%tmp9 = tail call <2 x float> @baz(<2 x float> <float 0xFFFFFFFFE0000000, float 0.000000e+00>, <2 x float> %tmp8, <2 x float> zeroinitializer) nounwind
|
||||
br i1 undef, label %bb10, label %bb12
|
||||
|
||||
bb10: ; preds = %bb3
|
||||
%tmp11 = load <4 x float>* undef, align 8
|
||||
br label %bb12
|
||||
|
||||
bb12: ; preds = %bb10, %bb3
|
||||
%tmp13 = shufflevector <2 x float> %tmp9, <2 x float> zeroinitializer, <2 x i32> <i32 0, i32 2>
|
||||
%tmp14 = bitcast <2 x float> %tmp13 to <1 x i64>
|
||||
%tmp15 = shufflevector <1 x i64> %tmp14, <1 x i64> zeroinitializer, <2 x i32> <i32 0, i32 1>
|
||||
%tmp16 = bitcast <2 x i64> %tmp15 to <4 x float>
|
||||
%tmp17 = fmul <4 x float> zeroinitializer, %tmp16
|
||||
%tmp18 = bitcast <4 x float> %tmp17 to <2 x i64>
|
||||
%tmp19 = shufflevector <2 x i64> %tmp18, <2 x i64> undef, <1 x i32> zeroinitializer
|
||||
%tmp20 = bitcast <1 x i64> %tmp19 to <2 x float>
|
||||
%tmp21 = tail call <2 x float> @baz67(<2 x float> %tmp20, <2 x float> undef) nounwind
|
||||
%tmp22 = tail call <2 x float> @baz67(<2 x float> %tmp21, <2 x float> %tmp21) nounwind
|
||||
%tmp23 = shufflevector <2 x float> %tmp22, <2 x float> undef, <4 x i32> zeroinitializer
|
||||
%tmp24 = bitcast <4 x float> %tmp23 to <2 x i64>
|
||||
%tmp25 = shufflevector <2 x i64> %tmp24, <2 x i64> undef, <1 x i32> zeroinitializer
|
||||
%tmp26 = bitcast <1 x i64> %tmp25 to <2 x float>
|
||||
%tmp27 = extractelement <2 x float> %tmp26, i32 0
|
||||
%tmp28 = fcmp olt float %tmp27, 0.000000e+00
|
||||
%tmp29 = select i1 %tmp28, i32 0, i32 undef
|
||||
%tmp30 = icmp ult i32 undef, %arg2
|
||||
br i1 %tmp30, label %bb3, label %bb31
|
||||
|
||||
bb31: ; preds = %bb12, %bb
|
||||
%tmp32 = phi i32 [ 1, %bb ], [ %tmp29, %bb12 ]
|
||||
ret i32 %tmp32
|
||||
}
|
||||
|
||||
declare <2 x float> @baz(<2 x float>, <2 x float>, <2 x float>) nounwind readnone
|
||||
|
||||
declare <2 x float> @baz67(<2 x float>, <2 x float>) nounwind readnone
|
||||
|
Loading…
Reference in New Issue
Block a user