Skip to content

Commit db4ba49

Browse files
committed
Adding the reachability check
1 parent 698e8c2 commit db4ba49

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

llvm/lib/CodeGen/MachinePipeliner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ void SwingSchedulerDAG::updatePhiDependences() {
980980
// S2_storerb_io %0:intregs, 0, %2:intregs
981981
// Make sure we do not create an edge between SU2 and SU0.
982982

983-
if (SU->NodeNum < I.NodeNum && !I.isPred(SU))
983+
if (SU->NodeNum < I.NodeNum && !I.isPred(SU) &&
984+
!IsReachable(&I, SU))
984985
SU->addPred(SDep(&I, SDep::Barrier));
985986
}
986987
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; RUN: llc -march=hexagon -mv71 -O2 < %s -o - 2>&1 > /dev/null
2+
; Ensure we do not invalidate a DAG by forming a circuit.
3+
; If we form a circuit, this test crashes while creating the DAG
4+
; with topological sorting.
5+
6+
%struct.quux = type { i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [2 x i8], %struct.ham, %struct.bar, i8 }
7+
%struct.ham = type { i8, [2 x i8], [2 x i8], [2 x i8] }
8+
%struct.bar = type { [2 x i8], [2 x i8], [2 x i8] }
9+
10+
define dso_local void @blam(i32 %arg) local_unnamed_addr #0 {
11+
bb:
12+
br label %bb1
13+
14+
bb1: ; preds = %bb1, %bb
15+
%phi = phi i8 [ %phi6, %bb1 ], [ undef, %bb ]
16+
%phi2 = phi i8 [ %phi, %bb1 ], [ undef, %bb ]
17+
%phi3 = phi i8 [ %phi2, %bb1 ], [ 0, %bb ]
18+
%phi4 = phi i8 [ %phi3, %bb1 ], [ undef, %bb ]
19+
%phi5 = phi i8 [ %phi4, %bb1 ], [ undef, %bb ]
20+
%phi6 = phi i8 [ %phi5, %bb1 ], [ undef, %bb ]
21+
%phi7 = phi i32 [ %add, %bb1 ], [ undef, %bb ]
22+
%getelementptr = getelementptr inbounds %struct.quux, ptr null, i32 %arg, i32 12, i32 1, i32 undef
23+
store i8 %phi4, ptr %getelementptr, align 1
24+
%add = add i32 %phi7, -1
25+
%icmp = icmp eq i32 %add, 0
26+
br i1 %icmp, label %bb8, label %bb1
27+
28+
bb8: ; preds = %bb1
29+
ret void
30+
}
31+
32+
attributes #0 = { "target-features"="+v71,-long-calls,-small-data" }

0 commit comments

Comments
 (0)