summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Analysis/MustExecute.h7
-rw-r--r--llvm/lib/Analysis/MustExecute.cpp15
2 files changed, 2 insertions, 20 deletions
diff --git a/llvm/include/llvm/Analysis/MustExecute.h b/llvm/include/llvm/Analysis/MustExecute.h
index 6a6a127b7c3..f136ff750de 100644
--- a/llvm/include/llvm/Analysis/MustExecute.h
+++ b/llvm/include/llvm/Analysis/MustExecute.h
@@ -66,11 +66,6 @@ public:
/// Copy colors of block \p Old into the block \p New.
void copyColors(BasicBlock *New, BasicBlock *Old);
- /// Returns true iff the header block of the loop for which this info is
- /// calculated contains an instruction that may throw or otherwise exit
- /// abnormally.
- virtual bool headerMayThrow() const = 0;
-
/// Returns true iff the block \p BB potentially may throw exception. It can
/// be false-positive in cases when we want to avoid complex analysis.
virtual bool blockMayThrow(const BasicBlock *BB) const = 0;
@@ -112,8 +107,6 @@ class SimpleLoopSafetyInfo: public LoopSafetyInfo {
bool HeaderMayThrow = false; // Same as previous, but specific to loop header
public:
- virtual bool headerMayThrow() const;
-
virtual bool blockMayThrow(const BasicBlock *BB) const;
virtual bool anyBlockMayThrow() const;
diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp
index 618e2e3e30d..4e42f336dc7 100644
--- a/llvm/lib/Analysis/MustExecute.cpp
+++ b/llvm/lib/Analysis/MustExecute.cpp
@@ -33,10 +33,6 @@ void LoopSafetyInfo::copyColors(BasicBlock *New, BasicBlock *Old) {
ColorsForNewBlock = ColorsForOldBlock;
}
-bool SimpleLoopSafetyInfo::headerMayThrow() const {
- return HeaderMayThrow;
-}
-
bool SimpleLoopSafetyInfo::blockMayThrow(const BasicBlock *BB) const {
(void)BB;
return anyBlockMayThrow();
@@ -203,10 +199,6 @@ bool LoopSafetyInfo::allLoopPathsLeadToBlock(const Loop *CurLoop,
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.
-
// If the instruction is in the header block for the loop (which is very
// common), it is always guaranteed to dominate the exit blocks. Since this
// is a common case, and can save some work, check it now.
@@ -215,15 +207,12 @@ bool SimpleLoopSafetyInfo::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 !headerMayThrow() ||
+ return !HeaderMayThrow ||
Inst.getParent()->getFirstNonPHIOrDbg() == &Inst;
// If there is a path from header to exit or latch that doesn't lead to our
// instruction's block, return false.
- if (!allLoopPathsLeadToBlock(CurLoop, Inst.getParent(), DT))
- return false;
-
- return true;
+ return allLoopPathsLeadToBlock(CurLoop, Inst.getParent(), DT);
}
OpenPOWER on IntegriCloud