diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 | 
| commit | 6b943ff3a3f8617113ecbf611cf0f8957e4e19d2 (patch) | |
| tree | fc5f365fb9035b2d0c622bbf06c9bbe8627d7279 /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | |
| parent | d0e4e96dc17a6c1c6de3340842c80f0e187ba349 (diff) | |
Notes
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
| -rw-r--r-- | lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 33 | 
1 files changed, 1 insertions, 32 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 78ff7346abe4..432adc9d046d 100644 --- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -364,34 +364,12 @@ static bool equivalentAddressValues(Value *A, Value *B) {    return false;  } -// If this instruction has two uses, one of which is a llvm.dbg.declare, -// return the llvm.dbg.declare. -DbgDeclareInst *InstCombiner::hasOneUsePlusDeclare(Value *V) { -  if (!V->hasNUses(2)) -    return 0; -  for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); -       UI != E; ++UI) { -    User *U = *UI; -    if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(U)) -      return DI; -    if (isa<BitCastInst>(U) && U->hasOneUse()) { -      if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(*U->use_begin())) -        return DI; -      } -  } -  return 0; -} -  Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {    Value *Val = SI.getOperand(0);    Value *Ptr = SI.getOperand(1);    // If the RHS is an alloca with a single use, zapify the store, making the    // alloca dead. -  // If the RHS is an alloca with a two uses, the other one being a  -  // llvm.dbg.declare, zapify the store and the declare, making the -  // alloca dead.  We must do this to prevent declares from affecting -  // codegen.    if (!SI.isVolatile()) {      if (Ptr->hasOneUse()) {        if (isa<AllocaInst>(Ptr))  @@ -400,17 +378,9 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {          if (isa<AllocaInst>(GEP->getOperand(0))) {            if (GEP->getOperand(0)->hasOneUse())              return EraseInstFromFunction(SI); -          if (DbgDeclareInst *DI = hasOneUsePlusDeclare(GEP->getOperand(0))) { -            EraseInstFromFunction(*DI); -            return EraseInstFromFunction(SI); -          }          }        }      } -    if (DbgDeclareInst *DI = hasOneUsePlusDeclare(Ptr)) { -      EraseInstFromFunction(*DI); -      return EraseInstFromFunction(SI); -    }    }    // Attempt to improve the alignment. @@ -621,8 +591,7 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {    // Insert a PHI node now if we need it.    Value *MergedVal = OtherStore->getOperand(0);    if (MergedVal != SI.getOperand(0)) { -    PHINode *PN = PHINode::Create(MergedVal->getType(), "storemerge"); -    PN->reserveOperandSpace(2); +    PHINode *PN = PHINode::Create(MergedVal->getType(), 2, "storemerge");      PN->addIncoming(SI.getOperand(0), SI.getParent());      PN->addIncoming(OtherStore->getOperand(0), OtherBB);      MergedVal = InsertNewInstBefore(PN, DestBB->front());  | 
