<div>Basically llvm-gcc on Cygwin was failing to build since r97884.</div><div><br></div><div>This patch for /lib/Target/X86/X86ISelLowering.cpp reverts the behaviour of the X86TargetLowering::LowerDYNAMIC_STACKALLOC method just for the Cygwin platform.</div>

<div><br></div><div>

llvm-gcc builds "correctly" again with this reversion.</div><div><br></div><div>All changes are contained within one function that is only executed by MinGW and Cygwin and the MinGW code is uneffected, and the Cygwin code is reverted back to pre r97883 code.</div>

<div><br></div><div>Is there any remote chance this could get into 2.7 as it is very well self contained method and should have no side effects.</div><div><br></div><div>Aaron</div><div><br></div><div>~~~~</div><div><div>

<font class="Apple-style-span" face="'courier new', monospace">SDValue</font></div><div><font class="Apple-style-span" face="'courier new', monospace">X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">                                           SelectionDAG &DAG) const {</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  assert(Subtarget->isTargetCygMing() &&</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">         "This should be used only on Cygwin/Mingw targets");</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  DebugLoc dl = Op.getDebugLoc();</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">  // Get the inputs.</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  SDValue Chain = Op.getOperand(0);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">  SDValue Size  = Op.getOperand(1);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  // FIXME: Ensure alignment here</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">  SDValue Flag;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>

</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  EVT IntPtr = getPointerTy();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  EVT SPTy = Subtarget->is64Bit() ? MVT::i64 : MVT::i32;</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">  if (Subtarget->isTargetMingw() {</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getCopyToReg(Chain, dl, X86::EAX, Size, Flag);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Flag = Chain.getValue(1);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getNode(X86ISD::MINGW_ALLOCA, dl, NodeTys, Chain, Flag);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">    Flag = Chain.getValue(1);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getCopyFromReg(Chain, dl, X86StackPtr, SPTy).getValue(1);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    SDValue Ops1[2] = { Chain.getValue(0), Chain };</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">    return DAG.getMergeValues(Ops1, 2, dl);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  } else {</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getCALLSEQ_START(Chain, DAG.getIntPtrConstant(0, true));</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>

</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getCopyToReg(Chain, dl, X86::EAX, Size, Flag);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Flag = Chain.getValue(1);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    SDVTList  NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">    SDValue Ops[] = { Chain,</font></div><div><font class="Apple-style-span" face="'courier new', monospace">                        DAG.getTargetExternalSymbol("_alloca", IntPtr),</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">                        DAG.getRegister(X86::EAX, IntPtr),</font></div><div><font class="Apple-style-span" face="'courier new', monospace">                        DAG.getRegister(X86StackPtr, SPTy),</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">                        Flag };</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getNode(X86ISD::CALL, dl, NodeTys, Ops, 5);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">    Flag = Chain.getValue(1);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getCALLSEQ_END(Chain,</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">                               DAG.getIntPtrConstant(0, true),</font></div><div><font class="Apple-style-span" face="'courier new', monospace">                               DAG.getIntPtrConstant(0, true),</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">                               Flag);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div>

<font class="Apple-style-span" face="'courier new', monospace">    Chain = DAG.getCopyFromReg(Chain, dl, X86StackPtr, SPTy).getValue(1);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>

</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    SDValue Ops1[2] = { Chain.getValue(0), Chain };</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    return DAG.getMergeValues(Ops1, 2, dl);</font></div>

<div><font class="Apple-style-span" face="'courier new', monospace">  }</font></div><div><font class="Apple-style-span" face="'courier new', monospace">}</font></div><div>~~~~</div></div><div><br></div><div>

<br></div>