summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2018-10-16 08:07:14 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2018-10-16 08:07:14 +0000
commit8d56be707038f99cf4e387c2a9390d39bea287cc (patch)
tree747a183644edc1c5f3c80469b64d94999c9fd045 /llvm/lib/Transforms
parentc9163855dd8b582f75921e01e903c3c27a57663d (diff)
downloadbcm5719-llvm-8d56be707038f99cf4e387c2a9390d39bea287cc.tar.gz
bcm5719-llvm-8d56be707038f99cf4e387c2a9390d39bea287cc.zip
[NFC] Encapsulate work with BlockColors in LoopSafetyInfo
llvm-svn: 344590
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 9bf75a4ffbf..6c899289593 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -798,7 +798,7 @@ static bool isFreeInLoop(const Instruction &I, const Loop *CurLoop,
static bool isNotUsedOrFreeInLoop(const Instruction &I, const Loop *CurLoop,
const LoopSafetyInfo *SafetyInfo,
TargetTransformInfo *TTI, bool &FreeInLoop) {
- const auto &BlockColors = SafetyInfo->BlockColors;
+ const auto &BlockColors = SafetyInfo->getBlockColors();
bool IsFree = isFreeInLoop(I, CurLoop, TTI);
for (const User *U : I.users()) {
const Instruction *UI = cast<Instruction>(U);
@@ -833,7 +833,7 @@ CloneInstructionInExitBlock(Instruction &I, BasicBlock &ExitBlock, PHINode &PN,
const LoopSafetyInfo *SafetyInfo) {
Instruction *New;
if (auto *CI = dyn_cast<CallInst>(&I)) {
- const auto &BlockColors = SafetyInfo->BlockColors;
+ const auto &BlockColors = SafetyInfo->getBlockColors();
// Sinking call-sites need to be handled differently from other
// instructions. The cloned call-site needs a funclet bundle operand
@@ -913,7 +913,7 @@ static bool canSplitPredecessors(PHINode *PN, LoopSafetyInfo *SafetyInfo) {
// it require updating BlockColors for all offspring blocks accordingly. By
// skipping such corner case, we can make updating BlockColors after splitting
// predecessor fairly simple.
- if (!SafetyInfo->BlockColors.empty() && BB->getFirstNonPHI()->isEHPad())
+ if (!SafetyInfo->getBlockColors().empty() && BB->getFirstNonPHI()->isEHPad())
return false;
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
BasicBlock *BBPred = *PI;
@@ -967,7 +967,7 @@ static void splitPredecessorsOfLoopExit(PHINode *PN, DominatorTree *DT,
// LE:
// %p = phi [%p1, %LE.split], [%p2, %LE.split2]
//
- auto &BlockColors = SafetyInfo->BlockColors;
+ const auto &BlockColors = SafetyInfo->getBlockColors();
SmallSetVector<BasicBlock *, 8> PredBBs(pred_begin(ExitBB), pred_end(ExitBB));
while (!PredBBs.empty()) {
BasicBlock *PredBB = *PredBBs.begin();
@@ -979,14 +979,11 @@ static void splitPredecessorsOfLoopExit(PHINode *PN, DominatorTree *DT,
// Since we do not allow splitting EH-block with BlockColors in
// canSplitPredecessors(), we can simply assign predecessor's color to
// the new block.
- if (!BlockColors.empty()) {
+ if (!BlockColors.empty())
// Grab a reference to the ColorVector to be inserted before getting the
// reference to the vector we are copying because inserting the new
// element in BlockColors might cause the map to be reallocated.
- ColorVector &ColorsForNewBlock = BlockColors[NewPred];
- ColorVector &ColorsForOldBlock = BlockColors[PredBB];
- ColorsForNewBlock = ColorsForOldBlock;
- }
+ SafetyInfo->copyColors(NewPred, PredBB);
}
PredBBs.remove(PredBB);
}
OpenPOWER on IntegriCloud