Skip to content

Commit c04dcff

Browse files
committed
Clean up with std::tie
1 parent 56cfd5f commit c04dcff

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ static cl::opt<bool> ForceMinByValParamAlign(
100100
" params of device functions."),
101101
cl::init(false));
102102

103-
static auto GetUpsizedNumEltsAndEltVT = [](unsigned OldNumElts, EVT OldEltVT) {
104-
// Number of elements to pack in one word.
105-
unsigned NPerWord = 32 / OldEltVT.getSizeInBits();
106-
// Word-sized vector.
107-
EVT NewEltVT = MVT::getVectorVT(OldEltVT.getSimpleVT(), NPerWord);
108-
// Number of word-sized vectors.
109-
unsigned NewNumElts = OldNumElts / NPerWord;
110-
return std::pair(NewNumElts, NewEltVT);
111-
};
112-
113103
int NVPTXTargetLowering::getDivF32Level() const {
114104
if (UsePrecDivF32.getNumOccurrences() > 0) {
115105
// If nvptx-prec-div32=N is used on the command-line, always honor it
@@ -172,6 +162,16 @@ static bool Is16bitsType(MVT VT) {
172162
VT.SimpleTy == MVT::i16);
173163
}
174164

165+
static auto GetUpsizedNumEltsAndEltVT(unsigned OldNumElts, EVT OldEltVT) {
166+
// Number of elements to pack in one word.
167+
unsigned NPerWord = 32 / OldEltVT.getSizeInBits();
168+
// Word-sized vector.
169+
EVT NewEltVT = MVT::getVectorVT(OldEltVT.getSimpleVT(), NPerWord);
170+
// Number of word-sized vectors.
171+
unsigned NewNumElts = OldNumElts / NPerWord;
172+
return std::pair(NewNumElts, NewEltVT);
173+
};
174+
175175
/// ComputePTXValueVTs - For the given Type \p Ty, returns the set of primitive
176176
/// EVTs that compose it. Unlike ComputeValueVTs, this will break apart vectors
177177
/// into their primitive components.
@@ -2883,9 +2883,7 @@ NVPTXTargetLowering::LowerSTOREVector(SDValue Op, SelectionDAG &DAG) const {
28832883
unsigned NumElts = ValVT.getVectorNumElements();
28842884

28852885
if (UpsizeElementTypes) {
2886-
auto [NewNumElts, NewEltVT] = GetUpsizedNumEltsAndEltVT(NumElts, EltVT);
2887-
NumElts = NewNumElts;
2888-
EltVT = NewEltVT;
2886+
std::tie(NumElts, EltVT) = GetUpsizedNumEltsAndEltVT(NumElts, EltVT);
28892887
}
28902888

28912889
// Since StoreV2 is a target node, we cannot rely on DAG type legalization.
@@ -5287,9 +5285,7 @@ static void ReplaceLoadVector(SDNode *N, SelectionDAG &DAG,
52875285
unsigned NumElts = ResVT.getVectorNumElements();
52885286

52895287
if (UpsizeElementTypes) {
5290-
auto [NewNumElts, NewEltVT] = GetUpsizedNumEltsAndEltVT(NumElts, EltVT);
5291-
NumElts = NewNumElts;
5292-
EltVT = NewEltVT;
5288+
std::tie(NumElts, EltVT) = GetUpsizedNumEltsAndEltVT(NumElts, EltVT);
52935289
}
52945290

52955291
// Since LoadV2 is a target node, we cannot rely on DAG type legalization.

0 commit comments

Comments
 (0)