diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-24 03:29:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-24 03:29:07 +0000 |
commit | b4017769aed86df862acfcc50c9fa4623df8c1e2 (patch) | |
tree | bae040d143ff31f087a8e3892ca50685540b1d23 /llvm/lib/Transforms/Utils/SSAUpdater.cpp | |
parent | 23289c385abf6bcd80251ca2197d07ff2644de1f (diff) | |
download | llvm-b4017769aed86df862acfcc50c9fa4623df8c1e2.zip llvm-b4017769aed86df862acfcc50c9fa4623df8c1e2.tar.gz llvm-b4017769aed86df862acfcc50c9fa4623df8c1e2.tar.bz2 |
fix PR9017, a bug where we'd assert when promoting in unreachable
code.
llvm-svn: 124100
Diffstat (limited to 'llvm/lib/Transforms/Utils/SSAUpdater.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SSAUpdater.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp index 0474a78..3896d98 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; } |