[SDAG] reduce code duplication and fix formatting; NFC

This commit is contained in:
Sanjay Patel 2022-02-12 10:22:13 -05:00
parent 1e1b60138c
commit 429f10f5f2
1 changed files with 12 additions and 13 deletions

View File

@ -19206,28 +19206,27 @@ SDValue DAGCombiner::scalarizeExtractedVectorLoad(SDNode *EVE, EVT InVecVT,
if (ResultVT.bitsGT(VecEltVT)) { if (ResultVT.bitsGT(VecEltVT)) {
// If the result type of vextract is wider than the load, then issue an // If the result type of vextract is wider than the load, then issue an
// extending load instead. // extending load instead.
ISD::LoadExtType ExtType = TLI.isLoadExtLegal(ISD::ZEXTLOAD, ResultVT, ISD::LoadExtType ExtType =
VecEltVT) TLI.isLoadExtLegal(ISD::ZEXTLOAD, ResultVT, VecEltVT) ? ISD::ZEXTLOAD
? ISD::ZEXTLOAD : ISD::EXTLOAD;
: ISD::EXTLOAD; Load = DAG.getExtLoad(ExtType, DL, ResultVT, OriginalLoad->getChain(),
Load = DAG.getExtLoad(ExtType, SDLoc(EVE), ResultVT, NewPtr, MPI, VecEltVT, Alignment,
OriginalLoad->getChain(), NewPtr, MPI, VecEltVT, OriginalLoad->getMemOperand()->getFlags(),
Alignment, OriginalLoad->getMemOperand()->getFlags(),
OriginalLoad->getAAInfo()); OriginalLoad->getAAInfo());
Chain = Load.getValue(1); Chain = Load.getValue(1);
} else { } else {
Load = DAG.getLoad( Load = DAG.getLoad(VecEltVT, DL, OriginalLoad->getChain(), NewPtr, MPI,
VecEltVT, SDLoc(EVE), OriginalLoad->getChain(), NewPtr, MPI, Alignment, Alignment, OriginalLoad->getMemOperand()->getFlags(),
OriginalLoad->getMemOperand()->getFlags(), OriginalLoad->getAAInfo()); OriginalLoad->getAAInfo());
Chain = Load.getValue(1); Chain = Load.getValue(1);
if (ResultVT.bitsLT(VecEltVT)) if (ResultVT.bitsLT(VecEltVT))
Load = DAG.getNode(ISD::TRUNCATE, SDLoc(EVE), ResultVT, Load); Load = DAG.getNode(ISD::TRUNCATE, DL, ResultVT, Load);
else else
Load = DAG.getBitcast(ResultVT, Load); Load = DAG.getBitcast(ResultVT, Load);
} }
WorklistRemover DeadNodes(*this); WorklistRemover DeadNodes(*this);
SDValue From[] = { SDValue(EVE, 0), SDValue(OriginalLoad, 1) }; SDValue From[] = {SDValue(EVE, 0), SDValue(OriginalLoad, 1)};
SDValue To[] = { Load, Chain }; SDValue To[] = {Load, Chain};
DAG.ReplaceAllUsesOfValuesWith(From, To, 2); DAG.ReplaceAllUsesOfValuesWith(From, To, 2);
// Make sure to revisit this node to clean it up; it will usually be dead. // Make sure to revisit this node to clean it up; it will usually be dead.
AddToWorklist(EVE); AddToWorklist(EVE);