diff options
| author | Andrew Kaylor <andrew.kaylor@intel.com> | 2015-11-23 19:51:41 +0000 |
|---|---|---|
| committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2015-11-23 19:51:41 +0000 |
| commit | 0615a0e65dd1da8941eda4db8d2d65ea02f40976 (patch) | |
| tree | 95ede5940e885076b19800ca9fa4afacc106fd18 /llvm/lib/Transforms | |
| parent | d200b27f08f9a2c00a6937eaeb610df1490fa805 (diff) | |
| download | bcm5719-llvm-0615a0e65dd1da8941eda4db8d2d65ea02f40976.tar.gz bcm5719-llvm-0615a0e65dd1da8941eda4db8d2d65ea02f40976.zip | |
[WinEH] Fix a case where GVN could incorrectly PRE a load into an EH pad.
Differential Revision: http://reviews.llvm.org/D14842
llvm-svn: 253908
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 1f9630ed511..3e5f5360372 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1555,6 +1555,16 @@ bool GVN::PerformLoadPRE(LoadInst *LI, AvailValInBlkVect &ValuesPerBlock, for (pred_iterator PI = pred_begin(LoadBB), E = pred_end(LoadBB); PI != E; ++PI) { BasicBlock *Pred = *PI; + + // If any predecessor block is an EH pad that does not allow non-PHI + // instructions before the terminator, we can't PRE the load. + if (Pred->getTerminator()->isEHPad()) { + DEBUG(dbgs() + << "COULD NOT PRE LOAD BECAUSE OF AN EH PAD PREDECESSOR '" + << Pred->getName() << "': " << *LI << '\n'); + return false; + } + if (IsValueFullyAvailableInBlock(Pred, FullyAvailableBlocks, 0)) { continue; } |

