diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-09 06:08:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-09 06:08:12 +0000 |
commit | 482eb70a10b831d449bdff5565355309f5861f10 (patch) | |
tree | e38ec91f253b483e7de821ed147b01816fc5b9b6 /llvm/lib/Transforms/Scalar/JumpThreading.cpp | |
parent | d48d1ec3203004ec6d7821115f7db2c865614e14 (diff) | |
download | bcm5719-llvm-482eb70a10b831d449bdff5565355309f5861f10.tar.gz bcm5719-llvm-482eb70a10b831d449bdff5565355309f5861f10.zip |
Fix PR3298, a crash in Jump Threading. Apparently even
jump threading can have bugs, who knew? ;-)
llvm-svn: 61983
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 59af14b8655..94d33aa7879 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -504,6 +504,10 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) { // If the value if the load is locally available within the block, just use // it. This frequently occurs for reg2mem'd allocas. //cerr << "LOAD ELIMINATED:\n" << *BBIt << *LI << "\n"; + + // If the returned value is the load itself, replace with an undef. This can + // only happen in dead loops. + if (AvailableVal == LI) AvailableVal = UndefValue::get(LI->getType()); LI->replaceAllUsesWith(AvailableVal); LI->eraseFromParent(); return true; |