diff options
author | Devang Patel <dpatel@apple.com> | 2009-10-13 21:41:20 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-10-13 21:41:20 +0000 |
commit | 1bf5ebc7be0d5b05e4175c7adb767b38896adef1 (patch) | |
tree | 4afba96037417ff290a37711cad7d24ed8f8d305 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | e5f879825f5e6746144addd93a852cdd5896e9c1 (diff) |
Do not check use_empty() before replaceAllUsesWith(). This gives ValueHandles a chance to get properly updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index b67bc050bd..5cb58e8d61 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -9979,8 +9979,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { new StoreInst(ConstantInt::getTrue(*Context), UndefValue::get(Type::getInt1PtrTy(*Context)), OldCall); - if (!OldCall->use_empty()) - OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType())); + OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType())); if (isa<CallInst>(OldCall)) // Not worth removing an invoke here. return EraseInstFromFunction(*OldCall); return 0; @@ -9994,9 +9993,8 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { UndefValue::get(Type::getInt1PtrTy(*Context)), CS.getInstruction()); - if (!CS.getInstruction()->use_empty()) - CS.getInstruction()-> - replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType())); + CS.getInstruction()-> + replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType())); if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) { // Don't break the CFG, insert a dummy cond branch. @@ -10251,7 +10249,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { } } - + if (!Caller->use_empty()) Caller->replaceAllUsesWith(NV); @@ -10398,7 +10396,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { setCallingConv(cast<CallInst>(Caller)->getCallingConv()); cast<CallInst>(NewCaller)->setAttributes(NewPAL); } - if (Caller->getType() != Type::getVoidTy(*Context) && !Caller->use_empty()) + if (Caller->getType() != Type::getVoidTy(*Context)) Caller->replaceAllUsesWith(NewCaller); Caller->eraseFromParent(); Worklist.Remove(Caller); @@ -12781,8 +12779,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { ++NumDeadInst; MadeIRChange = true; } - if (!I->use_empty()) - I->replaceAllUsesWith(UndefValue::get(I->getType())); + I->replaceAllUsesWith(UndefValue::get(I->getType())); I->eraseFromParent(); } } |