[llvm] r289740 - [NVPTX] Remove dead code.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 15:20:41 PST 2016
Author: jlebar
Date: Wed Dec 14 17:20:40 2016
New Revision: 289740
URL: http://llvm.org/viewvc/llvm-project?rev=289740&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.h
llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
llvm/trunk/lib/Target/NVPTX/NVVMReflect.cpp
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.cpp?rev=289740&r1=289739&r2=289740&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.cpp Wed Dec 14 17:20:40 2016
@@ -110,19 +110,6 @@ bool NVPTXInstrInfo::isStoreInstr(const
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
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.h?rev=289740&r1=289739&r2=289740&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.h Wed Dec 14 17:20:40 2016
@@ -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,
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp?rev=289740&r1=289739&r2=289740&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp Wed Dec 14 17:20:40 2016
@@ -314,110 +314,4 @@ bool getAlign(const CallInst &I, unsigne
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
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h?rev=289740&r1=289739&r2=289740&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h Wed Dec 14 17:20:40 2016
@@ -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
Modified: llvm/trunk/lib/Target/NVPTX/NVVMReflect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVVMReflect.cpp?rev=289740&r1=289739&r2=289740&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVVMReflect.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVVMReflect.cpp Wed Dec 14 17:20:40 2016
@@ -65,7 +65,6 @@ public:
bool runOnFunction(Function &) override;
private:
- bool handleFunction(Function *ReflectFunction);
void setVarMap();
};
}
More information about the llvm-commits
mailing list