diff options
| author | Hans Wennborg <hans@hanshq.net> | 2018-08-29 06:55:27 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2018-08-29 06:55:27 +0000 |
| commit | e0f3e9283f8249ad5253fbec10f68f3c81ae8b34 (patch) | |
| tree | bd2fd8ab5b851e898046da4523953b617d627ffc /llvm/lib | |
| parent | 01235a4033cf1fe107e3d711108a9c2dd5fa8190 (diff) | |
| download | bcm5719-llvm-e0f3e9283f8249ad5253fbec10f68f3c81ae8b34.tar.gz bcm5719-llvm-e0f3e9283f8249ad5253fbec10f68f3c81ae8b34.zip | |
LoopSink: Don't sink into blocks without an insertion point (PR38462)
In the PR, LoopSink was trying to sink into a catchswitch block, which
doesn't have a valid insertion point.
Differential Revision: https://reviews.llvm.org/D51307
llvm-svn: 340900
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopSink.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp index 240d727d1e2..67bcbdca185 100644 --- a/llvm/lib/Transforms/Scalar/LoopSink.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp @@ -152,6 +152,14 @@ findBBsToSinkInto(const Loop &L, const SmallPtrSetImpl<BasicBlock *> &UseBBs, } } + // Can't sink into blocks that have no valid insertion point. + for (BasicBlock *BB : BBsToSinkInto) { + if (BB->getFirstInsertionPt() == BB->end()) { + BBsToSinkInto.clear(); + break; + } + } + // If the total frequency of BBsToSinkInto is larger than preheader frequency, // do not sink. if (adjustedSumFreq(BBsToSinkInto, BFI) > |

