Skip to content

Commit

Permalink
Use SelectionDAG.getSplatBuildVector helper. NFCI.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289220 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
RKSimon committed Dec 9, 2016
1 parent 26486ab commit 8c44335
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3268,9 +3268,9 @@ void SelectionDAGBuilder::visitGetElementPtr(const User &I) {
if (VectorWidth && !N.getValueType().isVector()) {
LLVMContext &Context = *DAG.getContext();
EVT VT = EVT::getVectorVT(Context, N.getValueType(), VectorWidth);
SmallVector<SDValue, 16> Ops(VectorWidth, N);
N = DAG.getNode(ISD::BUILD_VECTOR, dl, VT, Ops);
N = DAG.getSplatBuildVector(VT, dl, N);
}

for (gep_type_iterator GTI = gep_type_begin(&I), E = gep_type_end(&I);
GTI != E; ++GTI) {
const Value *Idx = GTI.getOperand();
Expand Down Expand Up @@ -3326,9 +3326,9 @@ void SelectionDAGBuilder::visitGetElementPtr(const User &I) {

if (!IdxN.getValueType().isVector() && VectorWidth) {
MVT VT = MVT::getVectorVT(IdxN.getValueType().getSimpleVT(), VectorWidth);
SmallVector<SDValue, 16> Ops(VectorWidth, IdxN);
IdxN = DAG.getNode(ISD::BUILD_VECTOR, dl, VT, Ops);
IdxN = DAG.getSplatBuildVector(VT, dl, IdxN);
}

// If the index is smaller or larger than intptr_t, truncate or extend
// it.
IdxN = DAG.getSExtOrTrunc(IdxN, dl, N.getValueType());
Expand Down Expand Up @@ -3770,8 +3770,7 @@ static bool getUniformBase(const Value* &Ptr, SDValue& Base, SDValue& Index,
if (!Index.getValueType().isVector()) {
unsigned GEPWidth = GEP->getType()->getVectorNumElements();
EVT VT = EVT::getVectorVT(Context, Index.getValueType(), GEPWidth);
SmallVector<SDValue, 16> Ops(GEPWidth, Index);
Index = DAG.getNode(ISD::BUILD_VECTOR, SDLoc(Index), VT, Ops);
Index = DAG.getSplatBuildVector(VT, SDLoc(Index), Index);
}
return true;
}
Expand Down

0 comments on commit 8c44335

Please sign in to comment.