aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-10-13 22:56:32 +0000
committerDevang Patel <dpatel@apple.com>2009-10-13 22:56:32 +0000
commit228ebd0f4cf9207d32d61ef4b11b81736895dc09 (patch)
tree500e553f1dc26896a867dff04eca76207a6cf113 /lib/Transforms/Scalar/LoopUnswitch.cpp
parente72142aa5b8bcd9266a5a2f88e4e227dd178f233 (diff)
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/LoopUnswitch.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 07ee071d00..a217a32db0 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/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