[llvm] r344596 - [NFC] Remove obsolete method headerMayThrow

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 02:11:25 PDT 2018


Author: mkazantsev
Date: Tue Oct 16 02:11:25 2018
New Revision: 344596

URL: http://llvm.org/viewvc/llvm-project?rev=344596&view=rev
Log:
[NFC] Remove obsolete method headerMayThrow

Modified:
    llvm/trunk/include/llvm/Analysis/MustExecute.h
    llvm/trunk/lib/Analysis/MustExecute.cpp

Modified: llvm/trunk/include/llvm/Analysis/MustExecute.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MustExecute.h?rev=344596&r1=344595&r2=344596&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MustExecute.h (original)
+++ llvm/trunk/include/llvm/Analysis/MustExecute.h Tue Oct 16 02:11:25 2018
@@ -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 LoopS
   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;

Modified: llvm/trunk/lib/Analysis/MustExecute.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MustExecute.cpp?rev=344596&r1=344595&r2=344596&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MustExecute.cpp (original)
+++ llvm/trunk/lib/Analysis/MustExecute.cpp Tue Oct 16 02:11:25 2018
@@ -33,10 +33,6 @@ void LoopSafetyInfo::copyColors(BasicBlo
   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::allLoopPathsLeadToB
 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::isGuaranteedT
     // 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);
 }
 
 




More information about the llvm-commits mailing list