aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LICM.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/LICM.cpp
parente72142aa5b8bcd9266a5a2f88e4e227dd178f233 (diff)
downloadexternal_llvm-228ebd0f4cf9207d32d61ef4b11b81736895dc09.zip
external_llvm-228ebd0f4cf9207d32d61ef4b11b81736895dc09.tar.gz
external_llvm-228ebd0f4cf9207d32d61ef4b11b81736895dc09.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/LICM.cpp')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 89120a6..1574115 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -487,7 +487,10 @@ void LICM::sink(Instruction &I) {
// Instruction is not used, just delete it.
CurAST->deleteValue(&I);
// If I has users in unreachable blocks, eliminate.
- 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()));
I.eraseFromParent();
} else {
// Move the instruction to the start of the exit block, after any PHI
@@ -500,7 +503,10 @@ void LICM::sink(Instruction &I) {
// The instruction is actually dead if there ARE NO exit blocks.
CurAST->deleteValue(&I);
// If I has users in unreachable blocks, eliminate.
- 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()));
I.eraseFromParent();
} else {
// Otherwise, if we have multiple exits, use the PromoteMem2Reg function to