From owner-svn-src-all@FreeBSD.ORG Sun Sep 22 22:03:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8FBCA8BE; Sun, 22 Sep 2013 22:03:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3772987; Sun, 22 Sep 2013 22:03:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8MM3XrN006599; Sun, 22 Sep 2013 22:03:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8MM3UjJ006580; Sun, 22 Sep 2013 22:03:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201309222203.r8MM3UjJ006580@svn.freebsd.org> From: Dimitry Andric Date: Sun, 22 Sep 2013 22:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255804 - in head/contrib/llvm/lib: CodeGen/SelectionDAG Target/AArch64 Target/ARM Target/Hexagon Target/MSP430 Target/Mips Target/NVPTX Target/PowerPC Target/R600 Target/Sparc Target/S... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2013 22:03:33 -0000 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. }