diff options
author | Haicheng Wu <haicheng@codeaurora.org> | 2016-07-06 21:05:40 +0000 |
---|---|---|
committer | Haicheng Wu <haicheng@codeaurora.org> | 2016-07-06 21:05:40 +0000 |
commit | a95cd1267fbbbc1d33f7ab54b5b52583cee4b4cf (patch) | |
tree | 3477b4f0717af96fcc9c9f9dcb32ce64f0611f70 /llvm/lib | |
parent | 34913f3beb9bd06cbc7afe79d58184c9e7c123e6 (diff) | |
download | bcm5719-llvm-a95cd1267fbbbc1d33f7ab54b5b52583cee4b4cf.tar.gz bcm5719-llvm-a95cd1267fbbbc1d33f7ab54b5b52583cee4b4cf.zip |
[LIR] Fix mis-compilation with unwinding.
To fix PR27859, bail out if there is an instruction may throw.
Differential Revision: http://reviews.llvm.org/D20638
llvm-svn: 274673
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index a226865262e..ae0c84786e1 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -216,6 +216,14 @@ bool LoopIdiomRecognize::runOnCountableLoop() { << CurLoop->getHeader()->getName() << "\n"); bool MadeChange = false; + + // The following transforms hoist stores/memsets into the loop pre-header. + // Give up if the loop has instructions may throw. + LoopSafetyInfo SafetyInfo; + computeLoopSafetyInfo(&SafetyInfo, CurLoop); + if (SafetyInfo.MayThrow) + return MadeChange; + // Scan all the blocks in the loop that are not in subloops. for (auto *BB : CurLoop->getBlocks()) { // Ignore blocks in subloops. |