[llvm] r222046 - Turn a leaked object into a stack variable instead.
David Blaikie
dblaikie at gmail.com
Fri Nov 14 13:53:51 PST 2014
Author: dblaikie
Date: Fri Nov 14 15:53:50 2014
New Revision: 222046
URL: http://llvm.org/viewvc/llvm-project?rev=222046&view=rev
Log:
Turn a leaked object into a stack variable instead.
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=222046&r1=222045&r2=222046&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri Nov 14 15:53:50 2014
@@ -3304,14 +3304,14 @@ void CodeGenDAGPatterns::ParsePatterns()
if (LI->getSize() == 0) continue; // no pattern.
// Parse the instruction.
- TreePattern *Result = new TreePattern(CurPattern, LI, false, *this);
+ TreePattern Result(CurPattern, LI, false, *this);
// Inline pattern fragments into it.
- Result->InlinePatternFragments();
+ Result.InlinePatternFragments();
- if (Result->getNumTrees() != 1)
- Result->error("Cannot handle instructions producing instructions "
- "with temporaries yet!");
+ if (Result.getNumTrees() != 1)
+ Result.error("Cannot handle instructions producing instructions "
+ "with temporaries yet!");
bool IterateInference;
bool InferredAllPatternTypes, InferredAllResultTypes;
@@ -3324,7 +3324,7 @@ void CodeGenDAGPatterns::ParsePatterns()
// Infer as many types as possible. If we cannot infer all of them, we
// can never do anything with this pattern: report it to the user.
InferredAllResultTypes =
- Result->InferAllTypes(&Pattern->getNamedNodesMap());
+ Result.InferAllTypes(&Pattern->getNamedNodesMap());
IterateInference = false;
@@ -3332,13 +3332,13 @@ void CodeGenDAGPatterns::ParsePatterns()
// resolve cases where the input type is known to be a pointer type (which
// is considered resolved), but the result knows it needs to be 32- or
// 64-bits. Infer the other way for good measure.
- for (unsigned i = 0, e = std::min(Result->getTree(0)->getNumTypes(),
+ for (unsigned i = 0, e = std::min(Result.getTree(0)->getNumTypes(),
Pattern->getTree(0)->getNumTypes());
i != e; ++i) {
- IterateInference = Pattern->getTree(0)->
- UpdateNodeType(i, Result->getTree(0)->getExtType(i), *Result);
- IterateInference |= Result->getTree(0)->
- UpdateNodeType(i, Pattern->getTree(0)->getExtType(i), *Result);
+ IterateInference = Pattern->getTree(0)->UpdateNodeType(
+ i, Result.getTree(0)->getExtType(i), Result);
+ IterateInference |= Result.getTree(0)->UpdateNodeType(
+ i, Pattern->getTree(0)->getExtType(i), Result);
}
// If our iteration has converged and the input pattern's types are fully
@@ -3352,8 +3352,8 @@ void CodeGenDAGPatterns::ParsePatterns()
// arbitrary types to the result pattern's nodes.
if (!IterateInference && InferredAllPatternTypes &&
!InferredAllResultTypes)
- IterateInference = ForceArbitraryInstResultType(Result->getTree(0),
- *Result);
+ IterateInference =
+ ForceArbitraryInstResultType(Result.getTree(0), Result);
} while (IterateInference);
// Verify that we inferred enough types that we can do something with the
@@ -3362,7 +3362,7 @@ void CodeGenDAGPatterns::ParsePatterns()
Pattern->error("Could not infer all types in pattern!");
if (!InferredAllResultTypes) {
Pattern->dump();
- Result->error("Could not infer all types in pattern result!");
+ Result.error("Could not infer all types in pattern result!");
}
// Validate that the input pattern is correct.
@@ -3375,7 +3375,7 @@ void CodeGenDAGPatterns::ParsePatterns()
InstImpResults);
// Promote the xform function to be an explicit node if set.
- TreePatternNode *DstPattern = Result->getOnlyTree();
+ TreePatternNode *DstPattern = Result.getOnlyTree();
std::vector<TreePatternNode*> ResultNodeOperands;
for (unsigned ii = 0, ee = DstPattern->getNumChildren(); ii != ee; ++ii) {
TreePatternNode *OpNode = DstPattern->getChild(ii);
@@ -3387,16 +3387,16 @@ void CodeGenDAGPatterns::ParsePatterns()
}
ResultNodeOperands.push_back(OpNode);
}
- DstPattern = Result->getOnlyTree();
+ DstPattern = Result.getOnlyTree();
if (!DstPattern->isLeaf())
DstPattern = new TreePatternNode(DstPattern->getOperator(),
ResultNodeOperands,
DstPattern->getNumTypes());
- for (unsigned i = 0, e = Result->getOnlyTree()->getNumTypes(); i != e; ++i)
- DstPattern->setType(i, Result->getOnlyTree()->getExtType(i));
+ for (unsigned i = 0, e = Result.getOnlyTree()->getNumTypes(); i != e; ++i)
+ DstPattern->setType(i, Result.getOnlyTree()->getExtType(i));
- TreePattern Temp(Result->getRecord(), DstPattern, false, *this);
+ TreePattern Temp(Result.getRecord(), DstPattern, false, *this);
Temp.InferAllTypes();
More information about the llvm-commits
mailing list