diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2018-10-16 08:07:14 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-10-16 08:07:14 +0000 |
commit | 8d56be707038f99cf4e387c2a9390d39bea287cc (patch) | |
tree | 747a183644edc1c5f3c80469b64d94999c9fd045 /llvm/lib/Analysis | |
parent | c9163855dd8b582f75921e01e903c3c27a57663d (diff) | |
download | bcm5719-llvm-8d56be707038f99cf4e387c2a9390d39bea287cc.tar.gz bcm5719-llvm-8d56be707038f99cf4e387c2a9390d39bea287cc.zip |
[NFC] Encapsulate work with BlockColors in LoopSafetyInfo
llvm-svn: 344590
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/MustExecute.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp index 7f0912de26b..bce941be26c 100644 --- a/llvm/lib/Analysis/MustExecute.cpp +++ b/llvm/lib/Analysis/MustExecute.cpp @@ -22,6 +22,17 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; +const DenseMap<BasicBlock *, ColorVector> & +LoopSafetyInfo::getBlockColors() const { + return BlockColors; +} + +void LoopSafetyInfo::copyColors(BasicBlock *New, BasicBlock *Old) { + ColorVector &ColorsForNewBlock = BlockColors[New]; + ColorVector &ColorsForOldBlock = BlockColors[Old]; + ColorsForNewBlock = ColorsForOldBlock; +} + bool LoopSafetyInfo::headerMayThrow() const { return HeaderMayThrow; } @@ -35,7 +46,7 @@ bool LoopSafetyInfo::anyBlockMayThrow() const { return MayThrow; } -void LoopSafetyInfo::computeLoopSafetyInfo(Loop *CurLoop) { +void LoopSafetyInfo::computeLoopSafetyInfo(const Loop *CurLoop) { assert(CurLoop != nullptr && "CurLoop can't be null"); BasicBlock *Header = CurLoop->getHeader(); // Iterate over header and compute safety info. @@ -51,6 +62,10 @@ void LoopSafetyInfo::computeLoopSafetyInfo(Loop *CurLoop) { (BB != BBE) && !MayThrow; ++BB) MayThrow |= !isGuaranteedToTransferExecutionToSuccessor(*BB); + computeBlockColors(CurLoop); +} + +void LoopSafetyInfo::computeBlockColors(const Loop *CurLoop) { // Compute funclet colors if we might sink/hoist in a function with a funclet // personality routine. Function *Fn = CurLoop->getHeader()->getParent(); |