[X86] Attempt to fix use-after-poison from r359121.

llvm-svn: 359143
This commit is contained in:
Craig Topper 2019-04-24 21:48:24 +00:00
parent 28413dd87a
commit 6932abee2c
1 changed files with 5 additions and 2 deletions

View File

@ -2066,10 +2066,13 @@ bool X86DAGToDAGISel::selectAddr(SDNode *Parent, SDValue N, SDValue &Base,
AM.Segment = CurDAG->getRegister(X86::SS, MVT::i16);
}
// Save the DL and VT before calling matchAddress, it can invalidate N.
SDLoc DL(N);
MVT VT = N.getSimpleValueType();
if (matchAddress(N, AM))
return false;
MVT VT = N.getSimpleValueType();
if (AM.BaseType == X86ISelAddressMode::RegBase) {
if (!AM.Base_Reg.getNode())
AM.Base_Reg = CurDAG->getRegister(0, VT);
@ -2078,7 +2081,7 @@ bool X86DAGToDAGISel::selectAddr(SDNode *Parent, SDValue N, SDValue &Base,
if (!AM.IndexReg.getNode())
AM.IndexReg = CurDAG->getRegister(0, VT);
getAddressOperands(AM, SDLoc(N), Base, Scale, Index, Disp, Segment);
getAddressOperands(AM, DL, Base, Scale, Index, Disp, Segment);
return true;
}