Author: dim
Date: Sun Sep 22 22:03:30 2013
New Revision: 255804
URL: http://svnweb.freebsd.org/changeset/base/255804
Log:
Pull in r191165 from upstream llvm trunk:
ISelDAG: spot chain cycles involving MachineNodes
Previously, the DAGISel function WalkChainUsers was spotting that it
had entered already-selected territory by whether a node was a
MachineNode (amongst other things). Since it's fairly common practice
to insert MachineNodes during ISelLowering, this was not the correct
check.
Looking around, it seems that other nodes get their NodeId set to -1
upon selection, so this makes sure the same thing happens to all
MachineNodes and uses that characteristic to determine whether we
should stop looking for a loop during selection.
This should fix PR15840.
Specifically, this fixes the long-standing assertion failure when
compiling the multimedia/gstreamer port on i386. Thanks to Tijl
Coosemans for his help in getting upstream to fix it.
Approved by: re (marius)
Modified:
head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
head/contrib/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/R600/AMDILISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
==============================================================================
--- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Sep
22 21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Sep
22 22:03:30 2013 (r255804)
@@ -1736,15 +1736,15 @@ WalkChainUsers(const SDNode *ChainedNode
SDNode *User = *UI;
+ if (User->getOpcode() == ISD::HANDLENODE) // Root of the graph.
+ continue;
+
// If we see an already-selected machine node, then we've gone beyond the
// pattern that we're selecting down into the already selected chunk of the
// DAG.
- if (User->isMachineOpcode() ||
- User->getOpcode() == ISD::HANDLENODE) // Root of the graph.
- continue;
-
unsigned UserOpcode = User->getOpcode();
- if (UserOpcode == ISD::CopyToReg ||
+ if (User->isMachineOpcode() ||
+ UserOpcode == ISD::CopyToReg ||
UserOpcode == ISD::CopyFromReg ||
UserOpcode == ISD::INLINEASM ||
UserOpcode == ISD::EH_LABEL ||
Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp Sun Sep
22 21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp Sun Sep
22 22:03:30 2013 (r255804)
@@ -395,6 +395,7 @@ SDNode *AArch64DAGToDAGISel::Select(SDNo
if (Node->isMachineOpcode()) {
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << "\n");
+ Node->setNodeId(-1);
return NULL;
}
Modified: head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -2546,8 +2546,10 @@ SDNode *ARMDAGToDAGISel::SelectAtomic64(
SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
DebugLoc dl = N->getDebugLoc();
- if (N->isMachineOpcode())
+ if (N->isMachineOpcode()) {
+ N->setNodeId(-1);
return NULL; // Already selected.
+ }
switch (N->getOpcode()) {
default: break;
Modified: head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp Sun Sep
22 21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp Sun Sep
22 22:03:30 2013 (r255804)
@@ -1334,8 +1334,10 @@ SDNode *HexagonDAGToDAGISel::SelectAdd(S
SDNode *HexagonDAGToDAGISel::Select(SDNode *N) {
- if (N->isMachineOpcode())
+ if (N->isMachineOpcode()) {
+ N->setNodeId(-1);
return NULL; // Already selected.
+ }
switch (N->getOpcode()) {
Modified: head/contrib/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -394,6 +394,7 @@ SDNode *MSP430DAGToDAGISel::Select(SDNod
DEBUG(errs() << "== ";
Node->dump(CurDAG);
errs() << "\n");
+ Node->setNodeId(-1);
return NULL;
}
Modified: head/contrib/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -97,6 +97,7 @@ SDNode* MipsDAGToDAGISel::Select(SDNode
// If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");
+ Node->setNodeId(-1);
return NULL;
}
Modified: head/contrib/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -91,8 +91,10 @@ NVPTXDAGToDAGISel::NVPTXDAGToDAGISel(NVP
/// expanded, promoted and normal instructions.
SDNode *NVPTXDAGToDAGISel::Select(SDNode *N) {
- if (N->isMachineOpcode())
+ if (N->isMachineOpcode()) {
+ N->setNodeId(-1);
return NULL; // Already selected.
+ }
SDNode *ResNode = NULL;
switch (N->getOpcode()) {
Modified: head/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -895,8 +895,10 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDN
// target-specific node if it hasn't already been changed.
SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
DebugLoc dl = N->getDebugLoc();
- if (N->isMachineOpcode())
+ if (N->isMachineOpcode()) {
+ N->setNodeId(-1);
return NULL; // Already selected.
+ }
switch (N->getOpcode()) {
default: break;
Modified: head/contrib/llvm/lib/Target/R600/AMDILISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/R600/AMDILISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/R600/AMDILISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -158,6 +158,7 @@ bool AMDGPUDAGToDAGISel::SelectADDR64(SD
SDNode *AMDGPUDAGToDAGISel::Select(SDNode *N) {
unsigned int Opc = N->getOpcode();
if (N->isMachineOpcode()) {
+ N->setNodeId(-1);
return NULL; // Already selected.
}
switch (Opc) {
Modified: head/contrib/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -137,8 +137,10 @@ bool SparcDAGToDAGISel::SelectADDRrr(SDV
SDNode *SparcDAGToDAGISel::Select(SDNode *N) {
DebugLoc dl = N->getDebugLoc();
- if (N->isMachineOpcode())
+ if (N->isMachineOpcode()) {
+ N->setNodeId(-1);
return NULL; // Already selected.
+ }
switch (N->getOpcode()) {
default: break;
Modified: head/contrib/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp Sun Sep
22 21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp Sun Sep
22 22:03:30 2013 (r255804)
@@ -540,6 +540,7 @@ SDNode *SystemZDAGToDAGISel::Select(SDNo
// If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");
+ Node->setNodeId(-1);
return 0;
}
Modified: head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
==============================================================================
--- head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Sun Sep 22
21:58:59 2013 (r255803)
+++ head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Sun Sep 22
22:03:30 2013 (r255804)
@@ -1988,6 +1988,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *
if (Node->isMachineOpcode()) {
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n');
+ Node->setNodeId(-1);
return NULL; // Already selected.
}
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"