summaryrefslogtreecommitdiffstats
path: root/llvm/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
commita6771369003f884d6ab99b66c040703a08cdc374 (patch)
tree09d4a0097c1ffc7f5c5ed8a7a89f0762fe06cb84 /llvm/lib/Transforms/Scalar/LICM.cpp
parentfbd2d493980877a4aeb615d6ff5a155026328ec9 (diff)
downloadbcm5719-llvm-a6771369003f884d6ab99b66c040703a08cdc374.tar.gz
bcm5719-llvm-a6771369003f884d6ab99b66c040703a08cdc374.zip
Check void type before using RAUWd.
llvm-svn: 84049
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LICM.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 89120a6fb0c..1574115aa6c 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud