summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-12-14 23:20:40 +0000
committerJustin Lebar <jlebar@google.com>2016-12-14 23:20:40 +0000
commita54f4d7052b1237a15e14feb493738977a4a1d09 (patch)
tree569c1d3489e66d9e45fa4f01a3fbf8782136287e
parentde4749b7488c1b6b299af2c3e84fec636cc27280 (diff)
downloadbcm5719-llvm-a54f4d7052b1237a15e14feb493738977a4a1d09.tar.gz
bcm5719-llvm-a54f4d7052b1237a15e14feb493738977a4a1d09.zip
[NVPTX] Remove dead code.
I've chosen to remove NVPTXInstrInfo::CanTailMerge but not NVPTXInstrInfo::isLoadInstr and isStoreInstr (which are also dead) because while the latter two are reasonably useful utilities, the former cannot be used safely: It relies on successful address space inference to identify writes to shared memory, but addrspace inference is a best-effort thing. llvm-svn: 289740
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp13
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXInstrInfo.h1
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXUtilities.cpp106
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXUtilities.h9
-rw-r--r--llvm/lib/Target/NVPTX/NVVMReflect.cpp1
5 files changed, 0 insertions, 130 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp
index 60f8c47b7e4..7f89742a321 100644
--- a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp
@@ -110,19 +110,6 @@ bool NVPTXInstrInfo::isStoreInstr(const MachineInstr &MI,
return isStore;
}
-bool NVPTXInstrInfo::CanTailMerge(const MachineInstr *MI) const {
- unsigned addrspace = 0;
- if (MI->getOpcode() == NVPTX::INT_BARRIER0)
- return false;
- if (isLoadInstr(*MI, addrspace))
- if (addrspace == NVPTX::PTXLdStInstCode::SHARED)
- return false;
- if (isStoreInstr(*MI, addrspace))
- if (addrspace == NVPTX::PTXLdStInstCode::SHARED)
- return false;
- return true;
-}
-
/// AnalyzeBranch - Analyze the branching code at the end of MBB, returning
/// true if it cannot be understood (e.g. it's a switch dispatch or isn't
/// implemented for a target). Upon success, this returns false and returns
diff --git a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.h b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.h
index 3d3ae3507d8..d284282e28c 100644
--- a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.h
+++ b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.h
@@ -57,7 +57,6 @@ public:
bool isLoadInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
bool isStoreInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
- virtual bool CanTailMerge(const MachineInstr *MI) const;
// Branch analysis.
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
diff --git a/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp b/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp
index ba5c054b09c..e464f474b1d 100644
--- a/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp
@@ -314,110 +314,4 @@ bool getAlign(const CallInst &I, unsigned index, unsigned &align) {
return false;
}
-// The following are some useful utilities for debugging
-
-BasicBlock *getParentBlock(Value *v) {
- if (BasicBlock *B = dyn_cast<BasicBlock>(v))
- return B;
-
- if (Instruction *I = dyn_cast<Instruction>(v))
- return I->getParent();
-
- return nullptr;
-}
-
-Function *getParentFunction(Value *v) {
- if (Function *F = dyn_cast<Function>(v))
- return F;
-
- if (Instruction *I = dyn_cast<Instruction>(v))
- return I->getParent()->getParent();
-
- if (BasicBlock *B = dyn_cast<BasicBlock>(v))
- return B->getParent();
-
- return nullptr;
-}
-
-// Dump a block by name
-void dumpBlock(Value *v, char *blockName) {
- Function *F = getParentFunction(v);
- if (!F)
- return;
-
- for (Function::iterator it = F->begin(), ie = F->end(); it != ie; ++it) {
- BasicBlock *B = &*it;
- if (strcmp(B->getName().data(), blockName) == 0) {
- B->dump();
- return;
- }
- }
-}
-
-// Find an instruction by name
-Instruction *getInst(Value *base, char *instName) {
- Function *F = getParentFunction(base);
- if (!F)
- return nullptr;
-
- for (inst_iterator it = inst_begin(F), ie = inst_end(F); it != ie; ++it) {
- Instruction *I = &*it;
- if (strcmp(I->getName().data(), instName) == 0) {
- return I;
- }
- }
-
- return nullptr;
-}
-
-// Dump an instruction by name
-void dumpInst(Value *base, char *instName) {
- Instruction *I = getInst(base, instName);
- if (I)
- I->dump();
-}
-
-// Dump an instruction and all dependent instructions
-void dumpInstRec(Value *v, std::set<Instruction *> *visited) {
- if (Instruction *I = dyn_cast<Instruction>(v)) {
-
- if (visited->find(I) != visited->end())
- return;
-
- visited->insert(I);
-
- for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
- dumpInstRec(I->getOperand(i), visited);
-
- I->dump();
- }
-}
-
-// Dump an instruction and all dependent instructions
-void dumpInstRec(Value *v) {
- std::set<Instruction *> visited;
-
- //BasicBlock *B = getParentBlock(v);
-
- dumpInstRec(v, &visited);
-}
-
-// Dump the parent for Instruction, block or function
-void dumpParent(Value *v) {
- if (Instruction *I = dyn_cast<Instruction>(v)) {
- I->getParent()->dump();
- return;
- }
-
- if (BasicBlock *B = dyn_cast<BasicBlock>(v)) {
- B->getParent()->dump();
- return;
- }
-
- if (Function *F = dyn_cast<Function>(v)) {
- F->getParent()->dump();
- return;
- }
-}
-
} // namespace llvm
diff --git a/llvm/lib/Target/NVPTX/NVPTXUtilities.h b/llvm/lib/Target/NVPTX/NVPTXUtilities.h
index 0b189cde920..dad4d415347 100644
--- a/llvm/lib/Target/NVPTX/NVPTXUtilities.h
+++ b/llvm/lib/Target/NVPTX/NVPTXUtilities.h
@@ -63,15 +63,6 @@ bool isKernelFunction(const Function &);
bool getAlign(const Function &, unsigned index, unsigned &);
bool getAlign(const CallInst &, unsigned index, unsigned &);
-BasicBlock *getParentBlock(Value *v);
-Function *getParentFunction(Value *v);
-void dumpBlock(Value *v, char *blockName);
-Instruction *getInst(Value *base, char *instName);
-void dumpInst(Value *base, char *instName);
-void dumpInstRec(Value *v, std::set<Instruction *> *visited);
-void dumpInstRec(Value *v);
-void dumpParent(Value *v);
-
}
#endif
diff --git a/llvm/lib/Target/NVPTX/NVVMReflect.cpp b/llvm/lib/Target/NVPTX/NVVMReflect.cpp
index e0c35e7039e..c639c4dc068 100644
--- a/llvm/lib/Target/NVPTX/NVVMReflect.cpp
+++ b/llvm/lib/Target/NVPTX/NVVMReflect.cpp
@@ -65,7 +65,6 @@ public:
bool runOnFunction(Function &) override;
private:
- bool handleFunction(Function *ReflectFunction);
void setVarMap();
};
}
OpenPOWER on IntegriCloud