[llvm-commits] [llvm] r93979 - /llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
Victor Hernandez
vhernandez at apple.com
Tue Jan 19 22:58:02 PST 2010
On Jan 19, 2010, at 10:34 PM, Chris Lattner wrote:
>
> On Jan 19, 2010, at 9:49 PM, Victor Hernandez wrote:
>
>> Author: hernande
>> Date: Tue Jan 19 23:49:59 2010
>> New Revision: 93979
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=93979&view=rev
>> Log:
>> Map operands of all function-local metadata, not just metadata passed to llvm.dbg.declare intrinsics
>
> Hi Victor,
>
> This is causing a failure on a buildbot. The .data() method on std::vector is an extension that is not supported by all compilers.
I fixed this in r93989 without first reverting.
Victor
>
> -Chris
>
>>
>> Modified:
>> llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=93979&r1=93978&r2=93979&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Tue Jan 19 23:49:59 2010
>> @@ -29,11 +29,21 @@
>> // NOTE: VMSlot can be invalidated by any reference to VM, which can grow the
>> // DenseMap. This includes any recursive calls to MapValue.
>>
>> - // Global values and metadata do not need to be seeded into the ValueMap if
>> - // they are using the identity mapping.
>> - if (isa<GlobalValue>(V) || isa<InlineAsm>(V) || isa<MetadataBase>(V))
>> + // Global values and non-function-local metadata do not need to be seeded into
>> + // the ValueMap if they are using the identity mapping.
>> + if (isa<GlobalValue>(V) || isa<InlineAsm>(V) || isa<MDString>(V) ||
>> + (isa<MDNode>(V) && !dyn_cast<MDNode>(V)->isFunctionLocal()))
>> return VMSlot = const_cast<Value*>(V);
>>
>> + if (isa<MDNode>(V)) {
>> + const MDNode *MD = dyn_cast<MDNode>(V);
>> + std::vector<Value*> Elts;
>> + Elts.reserve(MD->getNumOperands());
>> + for (unsigned i = 0; i != MD->getNumOperands(); i++)
>> + Elts.push_back(MapValue(MD->getOperand(i), VM));
>> + return VM[V] = MDNode::get(V->getContext(), Elts.data(), Elts.size());
>> + }
>> +
>> Constant *C = const_cast<Constant*>(dyn_cast<Constant>(V));
>> if (C == 0) return 0;
>>
>> @@ -131,21 +141,5 @@
>> assert(V && "Referenced value not in value map!");
>> *op = V;
>> }
>> -
>> - // Map llvm.dbg.declare instruction's first operand, which points to
>> - // alloca instruction through MDNode. Since MDNodes are not counted as normal
>> - // uses, this will fall through cracks otherwise.
>> - const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I);
>> - if (!DDI) return;
>> -
>> - Value *AddrInsn = DDI->getAddress();
>> - if (!AddrInsn) return;
>> -
>> - ValueMapTy::iterator VMI = ValueMap.find(AddrInsn);
>> - if (VMI == ValueMap.end()) return;
>> -
>> - Value *Elts[] = { VMI->second };
>> - MDNode *NewAddr = MDNode::get(AddrInsn->getContext(), Elts, 1);
>> - I->setOperand(1, NewAddr);
>> }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list