summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-24 03:29:07 +0000
committerChris Lattner <sabre@nondot.org>2011-01-24 03:29:07 +0000
commitb4017769aed86df862acfcc50c9fa4623df8c1e2 (patch)
treebae040d143ff31f087a8e3892ca50685540b1d23 /llvm/lib/Transforms
parent23289c385abf6bcd80251ca2197d07ff2644de1f (diff)
downloadbcm5719-llvm-b4017769aed86df862acfcc50c9fa4623df8c1e2.tar.gz
bcm5719-llvm-b4017769aed86df862acfcc50c9fa4623df8c1e2.zip
fix PR9017, a bug where we'd assert when promoting in unreachable
code. llvm-svn: 124100
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SSAUpdater.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
index 0474a7842d1..3896d9851b2 100644
--- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -469,6 +469,9 @@ run(const SmallVectorImpl<Instruction*> &Insts) const {
LoadInst *ALoad = LiveInLoads[i];
Value *NewVal = SSA.GetValueInMiddleOfBlock(ALoad->getParent());
replaceLoadWithValue(ALoad, NewVal);
+
+ // Avoid assertions in unreachable code.
+ if (NewVal == ALoad) NewVal = UndefValue::get(NewVal->getType());
ALoad->replaceAllUsesWith(NewVal);
ReplacedLoads[ALoad] = NewVal;
}
OpenPOWER on IntegriCloud