mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
Don't include the is-function-local bit in the FoldingSetNodeID
for MDNodes, since this information is effectively implied by the operands. This allow allows the code to avoid doing a recursive is-it-really-function-local check in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3ac1884509
commit
7548fb37f1
@ -187,6 +187,19 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
|
||||
unsigned NumVals, FunctionLocalness FL,
|
||||
bool Insert) {
|
||||
LLVMContextImpl *pImpl = Context.pImpl;
|
||||
|
||||
// Add all the operand pointers. Note that we don't have to add the
|
||||
// isFunctionLocal bit because that's implied by the operands.
|
||||
FoldingSetNodeID ID;
|
||||
for (unsigned i = 0; i != NumVals; ++i)
|
||||
ID.AddPointer(Vals[i]);
|
||||
|
||||
void *InsertPoint;
|
||||
MDNode *N = NULL;
|
||||
|
||||
if ((N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint)))
|
||||
return N;
|
||||
|
||||
bool isFunctionLocal = false;
|
||||
switch (FL) {
|
||||
case FL_Unknown:
|
||||
@ -207,20 +220,6 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
|
||||
break;
|
||||
}
|
||||
|
||||
FoldingSetNodeID ID;
|
||||
for (unsigned i = 0; i != NumVals; ++i)
|
||||
ID.AddPointer(Vals[i]);
|
||||
ID.AddBoolean(isFunctionLocal);
|
||||
|
||||
void *InsertPoint;
|
||||
MDNode *N = NULL;
|
||||
|
||||
if ((N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint)))
|
||||
return N;
|
||||
|
||||
if (!Insert)
|
||||
return NULL;
|
||||
|
||||
// Coallocate space for the node and Operands together, then placement new.
|
||||
void *Ptr = malloc(sizeof(MDNode)+NumVals*sizeof(MDNodeOperand));
|
||||
N = new (Ptr) MDNode(Context, Vals, NumVals, isFunctionLocal);
|
||||
@ -275,9 +274,10 @@ Value *MDNode::getOperand(unsigned i) const {
|
||||
}
|
||||
|
||||
void MDNode::Profile(FoldingSetNodeID &ID) const {
|
||||
// Add all the operand pointers. Note that we don't have to add the
|
||||
// isFunctionLocal bit because that's implied by the operands.
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
||||
ID.AddPointer(getOperand(i));
|
||||
ID.AddBoolean(isFunctionLocal());
|
||||
}
|
||||
|
||||
void MDNode::setIsNotUniqued() {
|
||||
|
Loading…
Reference in New Issue
Block a user