diff options
author | Devang Patel <dpatel@apple.com> | 2009-10-13 22:56:32 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-10-13 22:56:32 +0000 |
commit | e3829c8912580d00aaf3c07661de34e4894983db (patch) | |
tree | 500e553f1dc26896a867dff04eca76207a6cf113 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | 31a5af59b207ac90e75ddd830ff6c2e916b4a7ae (diff) | |
download | external_llvm-e3829c8912580d00aaf3c07661de34e4894983db.zip external_llvm-e3829c8912580d00aaf3c07661de34e4894983db.tar.gz external_llvm-e3829c8912580d00aaf3c07661de34e4894983db.tar.bz2 |
Check void type before using RAUWd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 5cb58e8..88421db 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -9979,7 +9979,10 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { new StoreInst(ConstantInt::getTrue(*Context), UndefValue::get(Type::getInt1PtrTy(*Context)), OldCall); - OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType())); + // 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())); if (isa<CallInst>(OldCall)) // Not worth removing an invoke here. return EraseInstFromFunction(*OldCall); return 0; @@ -9993,8 +9996,11 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { UndefValue::get(Type::getInt1PtrTy(*Context)), CS.getInstruction()); - CS.getInstruction()-> - replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType())); + // 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()-> + replaceAllUsesWith(UndefValue::get(CS.getInstruction()->getType())); if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) { // Don't break the CFG, insert a dummy cond branch. @@ -12779,7 +12785,12 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { ++NumDeadInst; MadeIRChange = true; } - I->replaceAllUsesWith(UndefValue::get(I->getType())); + + + // 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->eraseFromParent(); } } |