From a6771369003f884d6ab99b66c040703a08cdc374 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 13 Oct 2009 22:56:32 +0000 Subject: Check void type before using RAUWd. llvm-svn: 84049 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp') diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 07ee071d00f..a217a32db00 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -781,7 +781,10 @@ void LoopUnswitch::RemoveBlockIfDead(BasicBlock *BB, // Anything that uses the instructions in this basic block should have their // uses replaced with undefs. - 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(I->getContext())) + I->replaceAllUsesWith(UndefValue::get(I->getType())); } // If this is the edge to the header block for a loop, remove the loop and -- cgit v1.2.3