[TableGen] Simplify how commuted variants are generated in GenerateVariantsOf. NFC
We don't need to copy the ChildVariants vector into a new vector. We're using std::move on every entry we copy so they clearly aren't needed again. We can swap entries in the vector and reuse it instead.
This commit is contained in:
parent
18777c7b0c
commit
6de3afeaef
@ -4695,17 +4695,10 @@ static void GenerateVariantsOf(TreePatternNodePtr N,
|
||||
}
|
||||
// Consider the commuted order.
|
||||
if (NoRegisters) {
|
||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||
unsigned i = 0;
|
||||
if (isCommIntrinsic)
|
||||
Variants.push_back(std::move(ChildVariants[i++])); // Intrinsic id.
|
||||
Variants.push_back(std::move(ChildVariants[i + 1]));
|
||||
Variants.push_back(std::move(ChildVariants[i]));
|
||||
i += 2;
|
||||
// Remaining operands are not commuted.
|
||||
for (; i != N->getNumChildren(); ++i)
|
||||
Variants.push_back(std::move(ChildVariants[i]));
|
||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||
// Swap the first two operands after the intrinsic id, if present.
|
||||
unsigned i = isCommIntrinsic ? 1 : 0;
|
||||
std::swap(ChildVariants[i], ChildVariants[i + 1]);
|
||||
CombineChildVariants(N, ChildVariants, OutVariants, CDP, DepVars);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user