summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instruction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-24 00:55:48 +0000
committerChris Lattner <sabre@nondot.org>2007-02-24 00:55:48 +0000
commit2195fc41ecad172e2abb45afa05d2e52975f623c (patch)
tree751c1703580876ade3c97c5046b795642ce1fce1 /llvm/lib/VMCore/Instruction.cpp
parenta33fd51520189cb4b981972512e0c890ca4cb026 (diff)
downloadbcm5719-llvm-2195fc41ecad172e2abb45afa05d2e52975f623c.tar.gz
bcm5719-llvm-2195fc41ecad172e2abb45afa05d2e52975f623c.zip
Refactor the setName stuff, moving it down the inheritance hierarchy, to
solve a crash in -instcombine -debug that was hit while investigating PR1217 llvm-svn: 34544
Diffstat (limited to 'llvm/lib/VMCore/Instruction.cpp')
-rw-r--r--llvm/lib/VMCore/Instruction.cpp33
1 files changed, 2 insertions, 31 deletions
diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp
index 2a740fcc958..feff59dff9f 100644
--- a/llvm/lib/VMCore/Instruction.cpp
+++ b/llvm/lib/VMCore/Instruction.cpp
@@ -19,7 +19,7 @@
using namespace llvm;
Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
- const std::string &Name, Instruction *InsertBefore)
+ Instruction *InsertBefore)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
// Make sure that we get added to a basicblock
LeakDetector::addGarbageObject(this);
@@ -30,11 +30,10 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
"Instruction to insert before is not in a basic block!");
InsertBefore->getParent()->getInstList().insert(InsertBefore, this);
}
- setName(Name);
}
Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
- const std::string &Name, BasicBlock *InsertAtEnd)
+ BasicBlock *InsertAtEnd)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
// Make sure that we get added to a basicblock
LeakDetector::addGarbageObject(this);
@@ -42,34 +41,6 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
// append this instruction into the basic block
assert(InsertAtEnd && "Basic block to append to may not be NULL!");
InsertAtEnd->getInstList().push_back(this);
- setName(Name);
-}
-
-Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
- const char *Name, Instruction *InsertBefore)
- : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
- // Make sure that we get added to a basicblock
- LeakDetector::addGarbageObject(this);
-
- // If requested, insert this instruction into a basic block...
- if (InsertBefore) {
- assert(InsertBefore->getParent() &&
- "Instruction to insert before is not in a basic block!");
- InsertBefore->getParent()->getInstList().insert(InsertBefore, this);
- }
- if (Name && *Name) setName(Name);
-}
-
-Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
- const char *Name, BasicBlock *InsertAtEnd)
- : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
- // Make sure that we get added to a basicblock
- LeakDetector::addGarbageObject(this);
-
- // append this instruction into the basic block
- assert(InsertAtEnd && "Basic block to append to may not be NULL!");
- InsertAtEnd->getInstList().push_back(this);
- if (Name && *Name) setName(Name);
}
OpenPOWER on IntegriCloud