summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/MustExecute.cpp
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2018-10-16 06:34:53 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2018-10-16 06:34:53 +0000
commitc8466f937cc2dbc80412dcfcb1051bf74f399a80 (patch)
treebaff1a18c1a7ebbff438b03e7694640bfc014ebd /llvm/lib/Analysis/MustExecute.cpp
parentf12a43d38a51b18e0f6587483d221f981cb4a892 (diff)
downloadbcm5719-llvm-c8466f937cc2dbc80412dcfcb1051bf74f399a80.tar.gz
bcm5719-llvm-c8466f937cc2dbc80412dcfcb1051bf74f399a80.zip
[NFC] Turn isGuaranteedToExecute into a method
llvm-svn: 344587
Diffstat (limited to 'llvm/lib/Analysis/MustExecute.cpp')
-rw-r--r--llvm/lib/Analysis/MustExecute.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp
index 79ec8e400c0..7c1ce86d15b 100644
--- a/llvm/lib/Analysis/MustExecute.cpp
+++ b/llvm/lib/Analysis/MustExecute.cpp
@@ -176,9 +176,9 @@ bool LoopSafetyInfo::allLoopPathsLeadToBlock(const Loop *CurLoop,
/// Returns true if the instruction in a loop is guaranteed to execute at least
/// once.
-bool llvm::isGuaranteedToExecute(const Instruction &Inst,
- const DominatorTree *DT, const Loop *CurLoop,
- const LoopSafetyInfo *SafetyInfo) {
+bool LoopSafetyInfo::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.
@@ -191,17 +191,17 @@ bool llvm::isGuaranteedToExecute(const Instruction &Inst,
// Inst unless we can prove that Inst comes before the potential implicit
// exit. At the moment, we use a (cheap) hack for the common case where
// the instruction of interest is the first one in the block.
- return !SafetyInfo->headerMayThrow() ||
- Inst.getParent()->getFirstNonPHIOrDbg() == &Inst;
+ return !headerMayThrow() ||
+ Inst.getParent()->getFirstNonPHIOrDbg() == &Inst;
// Somewhere in this loop there is an instruction which may throw and make us
// exit the loop.
- if (SafetyInfo->anyBlockMayThrow())
+ if (anyBlockMayThrow())
return false;
// If there is a path from header to exit or latch that doesn't lead to our
// instruction's block, return false.
- if (!SafetyInfo->allLoopPathsLeadToBlock(CurLoop, Inst.getParent(), DT))
+ if (!allLoopPathsLeadToBlock(CurLoop, Inst.getParent(), DT))
return false;
return true;
@@ -242,7 +242,7 @@ static bool isMustExecuteIn(const Instruction &I, Loop *L, DominatorTree *DT) {
// caller actually gets the full power at the moment.
LoopSafetyInfo LSI;
LSI.computeLoopSafetyInfo(L);
- return isGuaranteedToExecute(I, DT, L, &LSI) ||
+ return LSI.isGuaranteedToExecute(I, DT, L) ||
isGuaranteedToExecuteForEveryIteration(&I, L);
}
OpenPOWER on IntegriCloud