mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-03 11:24:18 +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:
@ -835,7 +835,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
|||||||
// If OldCall dues not return void then replaceAllUsesWith undef.
|
// If OldCall dues not return void then replaceAllUsesWith undef.
|
||||||
// This allows ValueHandlers and custom metadata to adjust itself.
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
if (!OldCall->getType()->isVoidTy())
|
if (!OldCall->getType()->isVoidTy())
|
||||||
OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
|
ReplaceInstUsesWith(*OldCall, UndefValue::get(OldCall->getType()));
|
||||||
if (isa<CallInst>(OldCall))
|
if (isa<CallInst>(OldCall))
|
||||||
return EraseInstFromFunction(*OldCall);
|
return EraseInstFromFunction(*OldCall);
|
||||||
|
|
||||||
@ -857,8 +857,8 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
|||||||
// If CS does not return void then replaceAllUsesWith undef.
|
// If CS does not return void then replaceAllUsesWith undef.
|
||||||
// This allows ValueHandlers and custom metadata to adjust itself.
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
if (!CS.getInstruction()->getType()->isVoidTy())
|
if (!CS.getInstruction()->getType()->isVoidTy())
|
||||||
CS.getInstruction()->
|
ReplaceInstUsesWith(*CS.getInstruction(),
|
||||||
replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType()));
|
UndefValue::get(CS.getInstruction()->getType()));
|
||||||
|
|
||||||
if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) {
|
if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) {
|
||||||
// Don't break the CFG, insert a dummy cond branch.
|
// Don't break the CFG, insert a dummy cond branch.
|
||||||
@ -1145,7 +1145,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Caller->use_empty())
|
if (!Caller->use_empty())
|
||||||
Caller->replaceAllUsesWith(NV);
|
ReplaceInstUsesWith(*Caller, NV);
|
||||||
|
|
||||||
EraseInstFromFunction(*Caller);
|
EraseInstFromFunction(*Caller);
|
||||||
return true;
|
return true;
|
||||||
@ -1291,7 +1291,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) {
|
|||||||
cast<CallInst>(NewCaller)->setAttributes(NewPAL);
|
cast<CallInst>(NewCaller)->setAttributes(NewPAL);
|
||||||
}
|
}
|
||||||
if (!Caller->getType()->isVoidTy())
|
if (!Caller->getType()->isVoidTy())
|
||||||
Caller->replaceAllUsesWith(NewCaller);
|
ReplaceInstUsesWith(*Caller, NewCaller);
|
||||||
Caller->eraseFromParent();
|
Caller->eraseFromParent();
|
||||||
Worklist.Remove(Caller);
|
Worklist.Remove(Caller);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -133,7 +133,7 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
|
|||||||
// New is the allocation instruction, pointer typed. AI is the original
|
// New is the allocation instruction, pointer typed. AI is the original
|
||||||
// allocation instruction, also pointer typed. Thus, cast to use is BitCast.
|
// allocation instruction, also pointer typed. Thus, cast to use is BitCast.
|
||||||
Value *NewCast = AllocaBuilder.CreateBitCast(New, AI.getType(), "tmpcast");
|
Value *NewCast = AllocaBuilder.CreateBitCast(New, AI.getType(), "tmpcast");
|
||||||
AI.replaceAllUsesWith(NewCast);
|
ReplaceInstUsesWith(AI, NewCast);
|
||||||
}
|
}
|
||||||
return ReplaceInstUsesWith(CI, New);
|
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.
|
// 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);
|
EraseInstFromFunction(*Call);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1261,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
|||||||
case Intrinsic::sadd_with_overflow:
|
case Intrinsic::sadd_with_overflow:
|
||||||
if (*EV.idx_begin() == 0) { // Normal result.
|
if (*EV.idx_begin() == 0) { // Normal result.
|
||||||
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
||||||
II->replaceAllUsesWith(UndefValue::get(II->getType()));
|
ReplaceInstUsesWith(*II, UndefValue::get(II->getType()));
|
||||||
EraseInstFromFunction(*II);
|
EraseInstFromFunction(*II);
|
||||||
return BinaryOperator::CreateAdd(LHS, RHS);
|
return BinaryOperator::CreateAdd(LHS, RHS);
|
||||||
}
|
}
|
||||||
@ -1278,7 +1278,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
|||||||
case Intrinsic::ssub_with_overflow:
|
case Intrinsic::ssub_with_overflow:
|
||||||
if (*EV.idx_begin() == 0) { // Normal result.
|
if (*EV.idx_begin() == 0) { // Normal result.
|
||||||
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
||||||
II->replaceAllUsesWith(UndefValue::get(II->getType()));
|
ReplaceInstUsesWith(*II, UndefValue::get(II->getType()));
|
||||||
EraseInstFromFunction(*II);
|
EraseInstFromFunction(*II);
|
||||||
return BinaryOperator::CreateSub(LHS, RHS);
|
return BinaryOperator::CreateSub(LHS, RHS);
|
||||||
}
|
}
|
||||||
@ -1287,7 +1287,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
|
|||||||
case Intrinsic::smul_with_overflow:
|
case Intrinsic::smul_with_overflow:
|
||||||
if (*EV.idx_begin() == 0) { // Normal result.
|
if (*EV.idx_begin() == 0) { // Normal result.
|
||||||
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
Value *LHS = II->getArgOperand(0), *RHS = II->getArgOperand(1);
|
||||||
II->replaceAllUsesWith(UndefValue::get(II->getType()));
|
ReplaceInstUsesWith(*II, UndefValue::get(II->getType()));
|
||||||
EraseInstFromFunction(*II);
|
EraseInstFromFunction(*II);
|
||||||
return BinaryOperator::CreateMul(LHS, RHS);
|
return BinaryOperator::CreateMul(LHS, RHS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user