summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2016-08-02 20:58:24 +0000
committerArtem Belevich <tra@google.com>2016-08-02 20:58:24 +0000
commitdb4bc667afe6decb6486b8f2ea643e5579a7a112 (patch)
tree2b2bd25161031d2a5d22248d1deb59c42b3a18f0 /llvm/lib
parent5d4276377992e8030ac6b148f762e34cb1254615 (diff)
downloadbcm5719-llvm-db4bc667afe6decb6486b8f2ea643e5579a7a112.tar.gz
bcm5719-llvm-db4bc667afe6decb6486b8f2ea643e5579a7a112.zip
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp36
1 files changed, 0 insertions, 36 deletions
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<GlobalVariable *, GlobalVariable *> GVMapTy;
typedef ValueMap<Constant *, Value *> 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<MDNode *, 16> 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<MDNode *>::iterator I = NewOperands.begin(),
- E = NewOperands.end();
- I != E; ++I) {
- N->addOperand(*I);
- }
-}
OpenPOWER on IntegriCloud