forked from OSchip/llvm-project
parent
fbd2d49398
commit
a677136900
|
@ -9979,6 +9979,9 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
||||||
new StoreInst(ConstantInt::getTrue(*Context),
|
new StoreInst(ConstantInt::getTrue(*Context),
|
||||||
UndefValue::get(Type::getInt1PtrTy(*Context)),
|
UndefValue::get(Type::getInt1PtrTy(*Context)),
|
||||||
OldCall);
|
OldCall);
|
||||||
|
// If OldCall dues not return void then replaceAllUsesWith undef.
|
||||||
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
|
if (OldCall->getType() != Type::getVoidTy(*Context))
|
||||||
OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
|
OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
|
||||||
if (isa<CallInst>(OldCall)) // Not worth removing an invoke here.
|
if (isa<CallInst>(OldCall)) // Not worth removing an invoke here.
|
||||||
return EraseInstFromFunction(*OldCall);
|
return EraseInstFromFunction(*OldCall);
|
||||||
|
@ -9993,6 +9996,9 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
||||||
UndefValue::get(Type::getInt1PtrTy(*Context)),
|
UndefValue::get(Type::getInt1PtrTy(*Context)),
|
||||||
CS.getInstruction());
|
CS.getInstruction());
|
||||||
|
|
||||||
|
// If CS dues not return void then replaceAllUsesWith undef.
|
||||||
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
|
if (CS.getInstruction()->getType() != Type::getVoidTy(*Context))
|
||||||
CS.getInstruction()->
|
CS.getInstruction()->
|
||||||
replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType()));
|
replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType()));
|
||||||
|
|
||||||
|
@ -12779,6 +12785,11 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
|
||||||
++NumDeadInst;
|
++NumDeadInst;
|
||||||
MadeIRChange = true;
|
MadeIRChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If I is not void type then replaceAllUsesWith undef.
|
||||||
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
|
if (I->getType() != Type::getVoidTy(*Context))
|
||||||
I->replaceAllUsesWith(UndefValue::get(I->getType()));
|
I->replaceAllUsesWith(UndefValue::get(I->getType()));
|
||||||
I->eraseFromParent();
|
I->eraseFromParent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,6 +487,9 @@ void LICM::sink(Instruction &I) {
|
||||||
// Instruction is not used, just delete it.
|
// Instruction is not used, just delete it.
|
||||||
CurAST->deleteValue(&I);
|
CurAST->deleteValue(&I);
|
||||||
// If I has users in unreachable blocks, eliminate.
|
// If I has users in unreachable blocks, eliminate.
|
||||||
|
// If I is not void type then replaceAllUsesWith undef.
|
||||||
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
|
if (I.getType() != Type::getVoidTy(I.getContext()))
|
||||||
I.replaceAllUsesWith(UndefValue::get(I.getType()));
|
I.replaceAllUsesWith(UndefValue::get(I.getType()));
|
||||||
I.eraseFromParent();
|
I.eraseFromParent();
|
||||||
} else {
|
} else {
|
||||||
|
@ -500,6 +503,9 @@ void LICM::sink(Instruction &I) {
|
||||||
// The instruction is actually dead if there ARE NO exit blocks.
|
// The instruction is actually dead if there ARE NO exit blocks.
|
||||||
CurAST->deleteValue(&I);
|
CurAST->deleteValue(&I);
|
||||||
// If I has users in unreachable blocks, eliminate.
|
// If I has users in unreachable blocks, eliminate.
|
||||||
|
// If I is not void type then replaceAllUsesWith undef.
|
||||||
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
|
if (I.getType() != Type::getVoidTy(I.getContext()))
|
||||||
I.replaceAllUsesWith(UndefValue::get(I.getType()));
|
I.replaceAllUsesWith(UndefValue::get(I.getType()));
|
||||||
I.eraseFromParent();
|
I.eraseFromParent();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -781,6 +781,9 @@ void LoopUnswitch::RemoveBlockIfDead(BasicBlock *BB,
|
||||||
|
|
||||||
// Anything that uses the instructions in this basic block should have their
|
// Anything that uses the instructions in this basic block should have their
|
||||||
// uses replaced with undefs.
|
// uses replaced with undefs.
|
||||||
|
// If I is not void type then replaceAllUsesWith undef.
|
||||||
|
// This allows ValueHandlers and custom metadata to adjust itself.
|
||||||
|
if (I->getType() != Type::getVoidTy(I->getContext()))
|
||||||
I->replaceAllUsesWith(UndefValue::get(I->getType()));
|
I->replaceAllUsesWith(UndefValue::get(I->getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue