mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-26 21:20:37 +00:00
Use ReplaceInstUsesWith instead of replaceAllUsesWith where appropriate in instcombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131512 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
28b42afcb8
commit
3e22cb9ec3
@ -835,7 +835,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
||||
// If OldCall dues not return void then replaceAllUsesWith undef.
|
||||
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||
if (!OldCall->getType()->isVoidTy())
|
||||
OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
|
||||
ReplaceInstUsesWith(*OldCall, UndefValue::get(OldCall->getType()));
|
||||
if (isa<CallInst>(OldCall))
|
||||
return EraseInstFromFunction(*OldCall);
|
||||
|
||||
@ -857,8 +857,8 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
||||
// If CS does not return void then replaceAllUsesWith undef.
|
||||
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||
if (!CS.getInstruction()->getType()->isVoidTy())
|
||||
CS.getInstruction()->
|
||||
replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType()));
|
||||
ReplaceInstUsesWith(*CS.getInstruction(),
|
||||
UndefValue::get(CS.getInstruction()->getType()));
|
||||
|
||||
if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) {
|
||||
// Don't break the CFG, insert a dummy cond branch.
|
||||
@ -1145,8 +1145,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
}
|
||||
|
||||
if (!Caller->use_empty())
|
||||
Caller->replaceAllUsesWith(NV);
|
||||
|
||||
ReplaceInstUsesWith(*Caller, NV);
|
||||
|
||||
EraseInstFromFunction(*Caller);
|
||||
return true;
|
||||
}
|
||||
@ -1291,7 +1291,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) {
|
||||
cast<CallInst>(NewCaller)->setAttributes(NewPAL);
|
||||
}
|
||||
if (!Caller->getType()->isVoidTy())
|
||||
Caller->replaceAllUsesWith(NewCaller);
|
||||
ReplaceInstUsesWith(*Caller, NewCaller);
|
||||
Caller->eraseFromParent();
|
||||
Worklist.Remove(Caller);
|
||||
return 0;
|
||||
|
@ -133,7 +133,7 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
|
||||
// New is the allocation instruction, pointer typed. AI is the original
|
||||
// allocation instruction, also pointer typed. Thus, cast to use is BitCast.
|
||||
Value *NewCast = AllocaBuilder.CreateBitCast(New, AI.getType(), "tmpcast");
|
||||
AI.replaceAllUsesWith(NewCast);
|
||||
ReplaceInstUsesWith(AI, NewCast);
|
||||
}
|
||||
return ReplaceInstUsesWith(CI, New);
|
||||
}
|
||||
@ -1228,7 +1228,7 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) {
|
||||
|
||||
|
||||
// Remove the old Call. With -fmath-errno, it won't get marked readnone.
|
||||
Call->replaceAllUsesWith(UndefValue::get(Call->getType()));
|
||||
ReplaceInstUsesWith(*Call, UndefValue::get(Call->getType()));
|
||||
EraseInstFromFunction(*Call);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1261,7 +1261,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
||||
case Intrinsic::sadd_with_overflow:
|
||||
if (*EV.idx_begin() == 0) { // Normal result.
|
||||
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
||||
II->replaceAllUsesWith(UndefValue::get(II->getType()));
|
||||
ReplaceInstUsesWith(*II, UndefValue::get(II->getType()));
|
||||
EraseInstFromFunction(*II);
|
||||
return BinaryOperator::CreateAdd(LHS, RHS);
|
||||
}
|
||||
@ -1278,7 +1278,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
||||
case Intrinsic::ssub_with_overflow:
|
||||
if (*EV.idx_begin() == 0) { // Normal result.
|
||||
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
||||
II->replaceAllUsesWith(UndefValue::get(II->getType()));
|
||||
ReplaceInstUsesWith(*II, UndefValue::get(II->getType()));
|
||||
EraseInstFromFunction(*II);
|
||||
return BinaryOperator::CreateSub(LHS, RHS);
|
||||
}
|
||||
@ -1287,7 +1287,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
||||
case Intrinsic::smul_with_overflow:
|
||||
if (*EV.idx_begin() == 0) { // Normal result.
|
||||
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
||||
II->replaceAllUsesWith(UndefValue::get(II->getType()));
|
||||
ReplaceInstUsesWith(*II, UndefValue::get(II->getType()));
|
||||
EraseInstFromFunction(*II);
|
||||
return BinaryOperator::CreateMul(LHS, RHS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user