[Hexagon] Remove dead nodes from SelectionDAG to avoid cycles

Recent changes to the instruction selection code exposed a problem where
a dead node was not removed on time. This node had both input and output
chains, which lead to an apparent cycle.

llvm-svn: 269458
This commit is contained in:
Krzysztof Parzyszek 2016-05-13 18:48:15 +00:00
parent a87b766027
commit 0f791f44c7
2 changed files with 20 additions and 1 deletions

View File

@ -654,7 +654,7 @@ bool HexagonDAGToDAGISel::tryLoadOfLoadIntrinsic(LoadSDNode *N) {
// This transformation will leave the intrinsic dead. If it remains in
// the DAG, the selection code will see it again, but without the load,
// and it will generate a store that is normally required for it.
CurDAG->RemoveDeadNodes();
CurDAG->RemoveDeadNode(C);
return true;
}
@ -1045,6 +1045,7 @@ void HexagonDAGToDAGISel::SelectZeroExtend(SDNode *N) {
void HexagonDAGToDAGISel::SelectIntrinsicWChain(SDNode *N) {
if (MachineSDNode *L = LoadInstrForLoadIntrinsic(N)) {
StoreInstrForLoadIntrinsic(L, N);
CurDAG->RemoveDeadNode(N);
return;
}
SelectCode(N);

View File

@ -0,0 +1,18 @@
; RUN: llc -march=hexagon < %s | FileCheck %s
; CHECK: = memw{{.*}}circ
target triple = "hexagon"
@l = external global i32, align 4
; Function Attrs: nounwind optsize
define void @circ2() #0 {
entry:
store i32 0, i32* @l, align 4
%0 = tail call i8* @llvm.hexagon.circ.ldw(i8* undef, i8* undef, i32 150995968, i32 4)
unreachable
}
declare i8* @llvm.hexagon.circ.ldw(i8*, i8*, i32, i32) #1
attributes #0 = { nounwind optsize }
attributes #1 = { argmemonly nounwind }