diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2018-10-16 08:31:05 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-10-16 08:31:05 +0000 |
commit | 9c90ec2fae508e08b0323db4d1a164cbf64c8bcc (patch) | |
tree | ca46501b390f90c3dd91c50704a0c69d873e9a1b /llvm/lib | |
parent | a5949439ca6adbb3b19dbd599880ff5b239f964e (diff) | |
download | bcm5719-llvm-9c90ec2fae508e08b0323db4d1a164cbf64c8bcc.tar.gz bcm5719-llvm-9c90ec2fae508e08b0323db4d1a164cbf64c8bcc.zip |
[NFC] Make LoopSafetyInfo abstract to allow alternative implementations
llvm-svn: 344592
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/MustExecute.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp index bce941be26c..618e2e3e30d 100644 --- a/llvm/lib/Analysis/MustExecute.cpp +++ b/llvm/lib/Analysis/MustExecute.cpp @@ -33,20 +33,20 @@ void LoopSafetyInfo::copyColors(BasicBlock *New, BasicBlock *Old) { ColorsForNewBlock = ColorsForOldBlock; } -bool LoopSafetyInfo::headerMayThrow() const { +bool SimpleLoopSafetyInfo::headerMayThrow() const { return HeaderMayThrow; } -bool LoopSafetyInfo::blockMayThrow(const BasicBlock *BB) const { +bool SimpleLoopSafetyInfo::blockMayThrow(const BasicBlock *BB) const { (void)BB; return anyBlockMayThrow(); } -bool LoopSafetyInfo::anyBlockMayThrow() const { +bool SimpleLoopSafetyInfo::anyBlockMayThrow() const { return MayThrow; } -void LoopSafetyInfo::computeLoopSafetyInfo(const Loop *CurLoop) { +void SimpleLoopSafetyInfo::computeLoopSafetyInfo(const Loop *CurLoop) { assert(CurLoop != nullptr && "CurLoop can't be null"); BasicBlock *Header = CurLoop->getHeader(); // Iterate over header and compute safety info. @@ -200,9 +200,9 @@ bool LoopSafetyInfo::allLoopPathsLeadToBlock(const Loop *CurLoop, /// Returns true if the instruction in a loop is guaranteed to execute at least /// once. -bool LoopSafetyInfo::isGuaranteedToExecute(const Instruction &Inst, - const DominatorTree *DT, - const Loop *CurLoop) const { +bool SimpleLoopSafetyInfo::isGuaranteedToExecute(const Instruction &Inst, + const DominatorTree *DT, + const Loop *CurLoop) const { // We have to check to make sure that the instruction dominates all // of the exit blocks. If it doesn't, then there is a path out of the loop // which does not execute this instruction, so we can't hoist it. @@ -259,7 +259,7 @@ static bool isMustExecuteIn(const Instruction &I, Loop *L, DominatorTree *DT) { // TODO: merge these two routines. For the moment, we display the best // result obtained by *either* implementation. This is a bit unfair since no // caller actually gets the full power at the moment. - LoopSafetyInfo LSI; + SimpleLoopSafetyInfo LSI; LSI.computeLoopSafetyInfo(L); return LSI.isGuaranteedToExecute(I, DT, L) || isGuaranteedToExecuteForEveryIteration(&I, L); diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 6c899289593..e72342b88b6 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -267,7 +267,7 @@ bool LoopInvariantCodeMotion::runOnLoop( BasicBlock *Preheader = L->getLoopPreheader(); // Compute loop safety information. - LoopSafetyInfo SafetyInfo; + SimpleLoopSafetyInfo SafetyInfo; SafetyInfo.computeLoopSafetyInfo(L); // We want to visit all of the instructions in this loop... that are not parts diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 9a45551f64b..4b375956a12 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -320,7 +320,7 @@ bool LoopIdiomRecognize::runOnCountableLoop() { // The following transforms hoist stores/memsets into the loop pre-header. // Give up if the loop has instructions may throw. - LoopSafetyInfo SafetyInfo; + SimpleLoopSafetyInfo SafetyInfo; SafetyInfo.computeLoopSafetyInfo(CurLoop); if (SafetyInfo.anyBlockMayThrow()) return MadeChange; diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index cd49f51283f..4a089dfa7db 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -189,7 +189,7 @@ namespace { BasicBlock *loopPreheader = nullptr; bool SanitizeMemory; - LoopSafetyInfo SafetyInfo; + SimpleLoopSafetyInfo SafetyInfo; // LoopBlocks contains all of the basic blocks of the loop, including the // preheader of the loop, the body of the loop, and the exit blocks of the diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp index c17a64f0187..8949c603a84 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp @@ -761,7 +761,7 @@ bool llvm::isSafeToUnrollAndJam(Loop *L, ScalarEvolution &SE, DominatorTree &DT, } // Check the loop safety info for exceptions. - LoopSafetyInfo LSI; + SimpleLoopSafetyInfo LSI; LSI.computeLoopSafetyInfo(L); if (LSI.anyBlockMayThrow()) { LLVM_DEBUG(dbgs() << "Won't unroll-and-jam; Something may throw\n"); |