assert((Child->getPredicateFns().empty() ||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
"Non-empty child predicate clobbered!");
- setChild(i, NewChild);
+ setChild(i, std::move(NewChild));
}
} else {
getChild(i)->SubstituteFormalArguments(ArgMap);
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
"Non-empty child predicate clobbered!");
- setChild(i, NewChild);
+ setChild(i, std::move(NewChild));
}
return T;
}
// Compute the map of formal to actual arguments.
std::map<std::string, TreePatternNodePtr> ArgMap;
for (unsigned i = 0, e = Frag->getNumArgs(); i != e; ++i) {
- TreePatternNodePtr Child = getChildShared(i);
+ const TreePatternNodePtr &Child = getChildShared(i);
ArgMap[Frag->getArgName(i)] = Child->InlinePatternFragments(Child, TP);
}
else // Otherwise, no chain.
Operator = getDAGPatterns().get_intrinsic_wo_chain_sdnode();
- TreePatternNodePtr IIDNode =
- std::make_shared<TreePatternNode>(IntInit::get(IID), 1);
- Children.insert(Children.begin(), IIDNode);
+ Children.insert(Children.begin(),
+ std::make_shared<TreePatternNode>(IntInit::get(IID), 1));
}
if (Operator->isSubClassOf("ComplexPattern")) {
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
TreePatternNodePtr Child = N->getChildShared(i);
MadeChange |= SimplifyTree(Child);
- N->setChild(i, Child);
+ N->setChild(i, std::move(Child));
}
return MadeChange;
}
DefaultOps[i]->getName() +
"' doesn't have a concrete type!");
}
- DefaultOpInfo.DefaultOps.push_back(TPN);
+ DefaultOpInfo.DefaultOps.push_back(std::move(TPN));
}
// Insert it into the DefaultOperands map so we can find it later.
if (!RNode)
I->error("Operand $" + OpName + " does not exist in operand list!");
- ResNodes.push_back(RNode);
Record *R = cast<DefInit>(RNode->getLeafValue())->getDef();
+ ResNodes.push_back(std::move(RNode));
if (!R)
I->error("Operand $" + OpName + " should be a set destination: all "
"outputs must occur before inputs in operand list!");
OpNode->getNumTypes());
}
- ResultNodeOperands.push_back(OpNode);
+ ResultNodeOperands.push_back(std::move(OpNode));
}
if (!InstInputsCheck.empty())
SrcNames[Entry.first].second == 1)
Pattern->error("Pattern has dead named input: $" + Entry.first);
- PatternsToMatch.push_back(std::move(PTM));
+ PatternsToMatch.push_back(PTM);
}
void CodeGenDAGPatterns::InferInstructionFlags() {
std::vector<Predicate> Preds = P.Predicates;
const std::vector<Predicate> &MC = ModeChecks[Mode];
Preds.insert(Preds.end(), MC.begin(), MC.end());
- PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, NewSrc, NewDst,
- P.getDstRegs(), P.getAddedComplexity(),
- Record::getNewUID(), Mode);
+ PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, std::move(NewSrc),
+ std::move(NewDst), P.getDstRegs(),
+ P.getAddedComplexity(), Record::getNewUID(),
+ Mode);
};
for (PatternToMatch &P : Copy) {
assert(NC >= 3 &&
"Commutative intrinsic should have at least 3 children!");
std::vector<std::vector<TreePatternNodePtr>> Variants;
- Variants.push_back(ChildVariants[0]); // Intrinsic id.
- Variants.push_back(ChildVariants[2]);
- Variants.push_back(ChildVariants[1]);
+ Variants.push_back(std::move(ChildVariants[0])); // Intrinsic id.
+ Variants.push_back(std::move(ChildVariants[2]));
+ Variants.push_back(std::move(ChildVariants[1]));
for (unsigned i = 3; i != NC; ++i)
- Variants.push_back(ChildVariants[i]);
+ Variants.push_back(std::move(ChildVariants[i]));
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
} else if (NC == N->getNumChildren()) {
std::vector<std::vector<TreePatternNodePtr>> Variants;
- Variants.push_back(ChildVariants[1]);
- Variants.push_back(ChildVariants[0]);
+ Variants.push_back(std::move(ChildVariants[1]));
+ Variants.push_back(std::move(ChildVariants[0]));
for (unsigned i = 2; i != NC; ++i)
- Variants.push_back(ChildVariants[i]);
+ Variants.push_back(std::move(ChildVariants[i]));
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
}
}