forked from OSchip/llvm-project
Revert r334374 [TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).
This breaks some builders. llvm-svn: 334376
This commit is contained in:
parent
15243d5a6d
commit
53b14db9f2
|
@ -1825,7 +1825,7 @@ void TreePatternNode::SubstituteFormalArguments(
|
|||
assert((Child->getPredicateFns().empty() ||
|
||||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
||||
"Non-empty child predicate clobbered!");
|
||||
setChild(i, std::move(NewChild));
|
||||
setChild(i, NewChild);
|
||||
}
|
||||
} else {
|
||||
getChild(i)->SubstituteFormalArguments(ArgMap);
|
||||
|
@ -1856,7 +1856,7 @@ TreePatternNodePtr TreePatternNode::InlinePatternFragments(TreePatternNodePtr T,
|
|||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
||||
"Non-empty child predicate clobbered!");
|
||||
|
||||
setChild(i, std::move(NewChild));
|
||||
setChild(i, NewChild);
|
||||
}
|
||||
return T;
|
||||
}
|
||||
|
@ -1884,8 +1884,7 @@ TreePatternNodePtr TreePatternNode::InlinePatternFragments(TreePatternNodePtr T,
|
|||
std::map<std::string, TreePatternNodePtr> ArgMap;
|
||||
for (unsigned i = 0, e = Frag->getNumArgs(); i != e; ++i) {
|
||||
TreePatternNodePtr Child = getChildShared(i);
|
||||
ArgMap[Frag->getArgName(i)] =
|
||||
Child->InlinePatternFragments(std::move(Child), TP);
|
||||
ArgMap[Frag->getArgName(i)] = Child->InlinePatternFragments(Child, TP);
|
||||
}
|
||||
|
||||
FragTree->SubstituteFormalArguments(ArgMap);
|
||||
|
@ -2674,8 +2673,9 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit,
|
|||
else // Otherwise, no chain.
|
||||
Operator = getDAGPatterns().get_intrinsic_wo_chain_sdnode();
|
||||
|
||||
Children.insert(Children.begin(),
|
||||
std::make_shared<TreePatternNode>(IntInit::get(IID), 1));
|
||||
TreePatternNodePtr IIDNode =
|
||||
std::make_shared<TreePatternNode>(IntInit::get(IID), 1);
|
||||
Children.insert(Children.begin(), IIDNode);
|
||||
}
|
||||
|
||||
if (Operator->isSubClassOf("ComplexPattern")) {
|
||||
|
@ -2736,7 +2736,7 @@ static bool SimplifyTree(TreePatternNodePtr &N) {
|
|||
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
|
||||
TreePatternNodePtr Child = N->getChildShared(i);
|
||||
MadeChange |= SimplifyTree(Child);
|
||||
N->setChild(i, std::move(Child));
|
||||
N->setChild(i, Child);
|
||||
}
|
||||
return MadeChange;
|
||||
}
|
||||
|
@ -3057,7 +3057,7 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
|
|||
DefaultOps[i]->getName() +
|
||||
"' doesn't have a concrete type!");
|
||||
}
|
||||
DefaultOpInfo.DefaultOps.push_back(std::move(TPN));
|
||||
DefaultOpInfo.DefaultOps.push_back(TPN);
|
||||
}
|
||||
|
||||
// Insert it into the DefaultOperands map so we can find it later.
|
||||
|
@ -3487,9 +3487,9 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
|
|||
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!");
|
||||
|
@ -3554,7 +3554,7 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
|
|||
OpNode->getNumTypes());
|
||||
}
|
||||
|
||||
ResultNodeOperands.push_back(std::move(OpNode));
|
||||
ResultNodeOperands.push_back(OpNode);
|
||||
}
|
||||
|
||||
if (!InstInputsCheck.empty())
|
||||
|
@ -4080,10 +4080,9 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
|
|||
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, std::move(NewSrc),
|
||||
std::move(NewDst), P.getDstRegs(),
|
||||
P.getAddedComplexity(), Record::getNewUID(),
|
||||
Mode);
|
||||
PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, NewSrc, NewDst,
|
||||
P.getDstRegs(), P.getAddedComplexity(),
|
||||
Record::getNewUID(), Mode);
|
||||
};
|
||||
|
||||
for (PatternToMatch &P : Copy) {
|
||||
|
@ -4387,18 +4386,18 @@ static void GenerateVariantsOf(TreePatternNodePtr N,
|
|||
assert(NC >= 3 &&
|
||||
"Commutative intrinsic should have at least 3 children!");
|
||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||
Variants.push_back(std::move(ChildVariants[0])); // Intrinsic id.
|
||||
Variants.push_back(std::move(ChildVariants[2]));
|
||||
Variants.push_back(std::move(ChildVariants[1]));
|
||||
Variants.push_back(ChildVariants[0]); // Intrinsic id.
|
||||
Variants.push_back(ChildVariants[2]);
|
||||
Variants.push_back(ChildVariants[1]);
|
||||
for (unsigned i = 3; i != NC; ++i)
|
||||
Variants.push_back(std::move(ChildVariants[i]));
|
||||
Variants.push_back(ChildVariants[i]);
|
||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||
} else if (NC == N->getNumChildren()) {
|
||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||
Variants.push_back(std::move(ChildVariants[1]));
|
||||
Variants.push_back(std::move(ChildVariants[0]));
|
||||
Variants.push_back(ChildVariants[1]);
|
||||
Variants.push_back(ChildVariants[0]);
|
||||
for (unsigned i = 2; i != NC; ++i)
|
||||
Variants.push_back(std::move(ChildVariants[i]));
|
||||
Variants.push_back(ChildVariants[i]);
|
||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -813,11 +813,7 @@ public:
|
|||
const std::vector<TreePatternNodePtr> &getTrees() const { return Trees; }
|
||||
unsigned getNumTrees() const { return Trees.size(); }
|
||||
const TreePatternNodePtr &getTree(unsigned i) const { return Trees[i]; }
|
||||
|
||||
void setTree(unsigned i, TreePatternNodePtr Tree) {
|
||||
Trees[i] = std::move(Tree);
|
||||
}
|
||||
|
||||
void setTree(unsigned i, TreePatternNodePtr Tree) { Trees[i] = Tree; }
|
||||
TreePatternNodePtr getOnlyTree() const {
|
||||
assert(Trees.size() == 1 && "Doesn't have exactly one pattern!");
|
||||
return Trees[0];
|
||||
|
|
Loading…
Reference in New Issue