Revert r112091, "Remap metadata attached to instructions when remapping

individual ...", which depends on r111922, which I am reverting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar
2010-08-26 03:48:08 +00:00
parent 6dabd9dba0
commit fd406f1ee2
5 changed files with 17 additions and 55 deletions

View File

@ -147,21 +147,10 @@ Value *llvm::MapValue(const Value *V, ValueToValueMapTy &VM) {
/// current values into those specified by VMap.
///
void llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap) {
// Remap operands.
for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) {
Value *V = MapValue(*op, VMap);
assert(V && "Referenced value not in value map!");
*op = V;
}
// Remap attached metadata.
SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
I->getAllMetadata(MDs);
for (SmallVectorImpl<std::pair<unsigned, MDNode *> >::iterator
MI = MDs.begin(), ME = MDs.end(); MI != ME; ++MI) {
Value *Old = MI->second;
Value *New = MapValue(Old, VMap);
if (New != Old)
I->setMetadata(MI->first, cast<MDNode>(New));
}
}