Adjust Valuehandle to hold its operand directly in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19897 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2005-01-29 00:37:36 +00:00
parent 23ba420550
commit 5598aa0328
2 changed files with 7 additions and 7 deletions

View File

@ -1258,15 +1258,14 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
ValueHandle::ValueHandle(ValueMapCache &VMC, Value *V) ValueHandle::ValueHandle(ValueMapCache &VMC, Value *V)
: Instruction(Type::VoidTy, UserOp1, ""), Cache(VMC) { : Instruction(Type::VoidTy, UserOp1, &Op, 1, ""), Op(V, this), Cache(VMC) {
//DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V); //DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V);
Operands.push_back(Use(V, this));
} }
ValueHandle::ValueHandle(const ValueHandle &VH) ValueHandle::ValueHandle(const ValueHandle &VH)
: Instruction(Type::VoidTy, UserOp1, ""), Cache(VH.Cache) { : Instruction(Type::VoidTy, UserOp1, &Op, 1, ""),
Op(VH.Op, this), Cache(VH.Cache) {
//DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V); //DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V);
Operands.push_back(Use((Value*)VH.getOperand(0), this));
} }
static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) { static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) {
@ -1291,9 +1290,9 @@ static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) {
} }
ValueHandle::~ValueHandle() { ValueHandle::~ValueHandle() {
if (Operands[0]->hasOneUse()) { if (Op->hasOneUse()) {
Value *V = Operands[0]; Value *V = Op;
Operands[0] = 0; // Drop use! Op.set(0); // Drop use!
// Now we just need to remove the old instruction so we don't get infinite // Now we just need to remove the old instruction so we don't get infinite
// loops. Note that we cannot use DCE because DCE won't remove a store // loops. Note that we cannot use DCE because DCE won't remove a store

View File

@ -59,6 +59,7 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *V,
// //
class ValueMapCache; class ValueMapCache;
class ValueHandle : public Instruction { class ValueHandle : public Instruction {
Use Op;
ValueMapCache &Cache; ValueMapCache &Cache;
public: public:
ValueHandle(ValueMapCache &VMC, Value *V); ValueHandle(ValueMapCache &VMC, Value *V);