From db4bc667afe6decb6486b8f2ea643e5579a7a112 Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Tue, 2 Aug 2016 20:58:24 +0000 Subject: [NVPTX] remove unnecessary named metadata update that happens to break debug info. Also added test case to verify IR changes done by NVPTXGenericToNVVM pass. Differential Revision: https://reviews.llvm.org/D22837 llvm-svn: 277520 --- llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp | 36 ---------------------------- 1 file changed, 36 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp b/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp index 66a964082c5..55d25574f39 100644 --- a/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp @@ -55,7 +55,6 @@ private: IRBuilder<> &Builder); Value *remapConstantExpr(Module *M, Function *F, ConstantExpr *C, IRBuilder<> &Builder); - void remapNamedMDNode(ValueToValueMapTy &VM, NamedMDNode *N); typedef ValueMap GVMapTy; typedef ValueMap ConstantToValueMapTy; @@ -130,12 +129,6 @@ bool GenericToNVVM::runOnModule(Module &M) { for (auto I = GVMap.begin(), E = GVMap.end(); I != E; ++I) VM[I->first] = I->second; - // Walk through the metadata section and update the debug information - // associated with the global variables in the default address space. - for (NamedMDNode &I : M.named_metadata()) { - remapNamedMDNode(VM, &I); - } - // Walk through the global variable initializers, and replace any use of // original global variables in GVMap with a use of the corresponding copies // in GVMap. The copies need to be bitcast to the original global variable @@ -360,32 +353,3 @@ Value *GenericToNVVM::remapConstantExpr(Module *M, Function *F, ConstantExpr *C, llvm_unreachable("GenericToNVVM encountered an unsupported ConstantExpr"); } } - -void GenericToNVVM::remapNamedMDNode(ValueToValueMapTy &VM, NamedMDNode *N) { - - bool OperandChanged = false; - SmallVector NewOperands; - unsigned NumOperands = N->getNumOperands(); - - // Check if any operand is or contains a global variable in GVMap, and thus - // converted to another value. - for (unsigned i = 0; i < NumOperands; ++i) { - MDNode *Operand = N->getOperand(i); - MDNode *NewOperand = MapMetadata(Operand, VM); - OperandChanged |= Operand != NewOperand; - NewOperands.push_back(NewOperand); - } - - // If none of the operands has been modified, return immediately. - if (!OperandChanged) { - return; - } - - // Replace the old operands with the new operands. - N->dropAllReferences(); - for (SmallVectorImpl::iterator I = NewOperands.begin(), - E = NewOperands.end(); - I != E; ++I) { - N->addOperand(*I); - } -} -- cgit v1.2.3